Skip to content

Add Open Graph/title meta tags to viewer index.html - #81

Open
fmigneault wants to merge 1 commit into
opengeospatial:masterfrom
crim-ca:fix/viewer-og-meta-tags
Open

Add Open Graph/title meta tags to viewer index.html#81
fmigneault wants to merge 1 commit into
opengeospatial:masterfrom
crim-ca:fix/viewer-og-meta-tags

Conversation

@fmigneault

Copy link
Copy Markdown
Member

Problem

The viewer shell's index.html (generated in validate-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-viewer sets document.title dynamically via JS after the SPA loads.

Fix

Populate <title>, og:title/og:description/og:url/og:type, twitter:card/title/description, and name=description from the register's name/description (falling back to abstract), 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.

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>
@avillar

avillar commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

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...

@fmigneault

fmigneault commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

I don't think abstract is very widespread compared to description field. It implies using extra profile details according to https://www.w3.org/TR/html401/struct/global.html#h-7.4.4, such that it is registered as known term.

It doesn't look like abstract is part of HTML5 either, but description is (https://html.spec.whatwg.org/multipage/semantics.html#standard-metadata-names).

Similarly, Open Graph defines the title/description, but not abstract.

I would keep description for consistency between versions.

@rob-metalinkage

Copy link
Copy Markdown
Collaborator

Looks ok to me. But i am not in the weeds of HTML these days so only looking at requirements and logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants