Skip to content

Add get_preview and get_preview_image for link unfurling - #121

Merged
Robbie1977 merged 1 commit into
mainfrom
feature/link-preview
Sep 22, 2026
Merged

Robbie1977 merged 1 commit into
mainfrom
feature/link-preview

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

Slack, Bluesky, Teams and the rest build a link card from the og:* tags in
a page's raw HTML, and none of them run JavaScript. The viewer sets those
tags per term from JS only, so a pasted term link previews as the site logo
whatever the term.

get_preview?id= renders the same tags server-side from get_term_info --
title, description, thumbnail, canonical to /reports/ -- with a
meta-refresh into the viewer so a human landing here still arrives where the
link pointed. Intended for an IRI-routing branch that hands unfurler
user-agents this instead of the redirect.

get_preview_image?id= redirects to the term's thumbnail, or the logo
when it has none: a stable id-keyed image URL for og:image, cards and the MCP.

Both reuse the term_info: cache key, so a preview costs no extra term
lookup and a burst of unfurlers for one link coalesces to one query; the
HTML is a 2KB response v3-cached stores like any other.

Title and description logic mirrors pageMetadata.js in geppetto-vfb so a term
reads the same wherever its preview is built -- except that ';' in Types
becomes ', ' rather than ',', which reads as a list; the JS wants the same fix
on its next release.

Ontology text is HTML-escaped, and ids are validated against the VFB id shape
before any lookup.

Slack, Bluesky, Teams and the rest build a link card from the og:*
tags in a page's raw HTML, and none of them run JavaScript. The viewer
sets those tags per term from JS only, so a pasted term link previews as
the site logo whatever the term.

get_preview?id=<id> renders the same tags server-side from get_term_info
-- title, description, thumbnail, canonical to /reports/<id> -- with a
meta-refresh into the viewer so a human landing here still arrives where
the link pointed. Intended for an IRI-routing branch that hands unfurler
user-agents this instead of the redirect.

get_preview_image?id=<id> redirects to the term's thumbnail, or the logo
when it has none: a stable id-keyed image URL for og:image, cards and the
MCP.

Both reuse the term_info:<id> cache key, so a preview costs no extra term
lookup and a burst of unfurlers for one link coalesces to one query; the
HTML is a 2KB response v3-cached stores like any other.

Title and description logic mirrors pageMetadata.js in geppetto-vfb so a
term reads the same wherever its preview is built -- except that ';' in
Types becomes ', ' rather than ',', which reads as a list; the JS wants
the same fix on its next release.

Ontology text is HTML-escaped, and ids are validated against the VFB id
shape before any lookup.
@Robbie1977
Robbie1977 merged commit 1ea5a7c into main Sep 22, 2026
2 of 5 checks passed
@github-actions

Copy link
Copy Markdown

⚠️ 1 test(s) skipped — an upstream data source was unreachable

The full suite ran, but 1 test(s) were skipped because an upstream data source (VFB's Neo4j / SOLR / Owlery, or FlyBase's Chado) did not answer during this run.

These are not failures and not a problem with this branch — but those queries went unverified, so a green check here is an incomplete run.

To re-run: open this workflow run and click Re-run all jobs once the data sources are healthy (re-running the “Run completeness” check itself does nothing — it has no job behind it).

1 failed, 873 passed, 1 skipped, 340 warnings in 1078.55s (0:17:58)

Posted automatically. This comment is removed once a run completes with zero skips.

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.

1 participant