Add Open Graph/title meta tags to viewer index.html - #81
Conversation
The viewer shell's index.html had a hardcoded <title>OGC Location Building Blocks</title> 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 <title>, 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>
|
Thanks for this, I like it a lot. One question: should we use description or just abstract? Description is intended to be longer, and it'll possibly contain different paragraphs and such, which may not be all that well suited for a meta tag. IMHO, the abstract is much better for this... |
|
I don't think It doesn't look like Similarly, Open Graph defines the I would keep |
|
Looks ok to me. But i am not in the weeds of HTML these days so only looking at requirements and logic. |
Problem
The viewer shell's
index.html(generated invalidate-and-process.yml, "Deploy Building Blocks viewer" step) had a hardcoded<title>OGC Location Building Blocks</title>and no Open Graph / Twitter meta tags.Link preview/rendering cards (Slack, Discord, Twitter/X, etc.) fetch the raw HTML without executing the SPA's JS, so every register deployed via this workflow showed the same generic title in link previews, regardless of the register's actual content (e.g. a STAC building block register showed "OGC Location Building Blocks" instead of something reflecting STAC).
The browser tab title was unaffected since
bblocks-viewersetsdocument.titledynamically via JS after the SPA loads.Fix
Populate
<title>,og:title/og:description/og:url/og:type,twitter:card/title/description, andname=descriptionfrom the register'sname/description(falling back toabstract), HTML-escaped for safety.Scope / limitations
This fixes the register root landing page card. Per-block deep links within the SPA still can't get distinct link previews without SSR/prerendering, since a client-side-only SPA can't serve different static meta per route.