From 3160c6d5182e3a755bd77319afdebd90edec8652 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 9 Sep 2026 11:14:46 -0400 Subject: [PATCH] Add Open Graph/title meta tags to viewer index.html The viewer shell's index.html had a hardcoded OGC Location Building Blocks and no Open Graph/Twitter meta tags. Link preview cards (Slack, Discord, Twitter, etc.) read the raw HTML without executing the SPA's JS, so every register deployed via this workflow showed the same generic title regardless of its actual content. Populate , og:title/description/url/type, twitter:card and name=description from the register's name/description (or abstract) so link previews reflect the actual building block register. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/validate-and-process.yml | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-and-process.yml b/.github/workflows/validate-and-process.yml index 5bbd5bf..1fe96a4 100644 --- a/.github/workflows/validate-and-process.yml +++ b/.github/workflows/validate-and-process.yml @@ -289,7 +289,19 @@ jobs: if [[ "${BASE_URL}" =~ [^/]$ ]]; then BASE_URL="${BASE_URL}/" fi - + + # Pull register name/description for the viewer shell's <title> and Open Graph + # meta tags, so link preview cards (which don't execute the SPA's JS) show + # something more specific than a generic hardcoded title. + REG_NAME="$(jq -r '.name // "OGC Building Blocks"' < "$REGISTER_FILE")" + REG_DESCRIPTION="$(jq -r '.description // .abstract // ""' < "$REGISTER_FILE")" + html_escape() { + sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' + } + REG_NAME_HTML="$(printf '%s' "$REG_NAME" | html_escape)" + REG_DESCRIPTION_HTML="$(printf '%s' "$REG_DESCRIPTION" | html_escape)" + PAGE_URL="${{ steps.get-pages-url.outputs.result }}/${BASE_URL}" + cat << EOF > index.html <!DOCTYPE html> <html lang="en"> @@ -297,7 +309,15 @@ jobs: <meta charset="UTF-8" /> <link rel="icon" href="https://ogcincubator.github.io/bblocks-viewer/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>OGC Location Building Blocks + ${REG_NAME_HTML} + + + + + + + +