Repository navigation
feat(GAT-5649): Add generated opengraph metadata - #1758
Conversation
|
|
🎉 Great job! Your PR title follows the correct format. 🚀 |
HDRUK-Claude
left a comment
There was a problem hiding this comment.
🤖 Review-E automated review
The metadata refactor and the entity page changes are low risk. Metadata fetches reuse the same memoised calls as the page bodies, and the entity-image lookup is limited by an allowlist. The main concern is the new unauthenticated /api/og route: it renders and publicly caches any title it is given.
Findings: 🟠 Medium × 1
Automated review by Claude. Advisory only. A human approval is still required.
HDRUK-Claude
left a comment
There was a problem hiding this comment.
🤖 Review-E automated review
The new commits are low risk. They stop the [locale] layout from passing Open Graph and Twitter tags down to every page: it now exports defaultMetadata, and metaData() sets openGraph and twitter to null whenever noFollowRobots is passed. Every caller I found passes either the default or noFollowRobots, so the reference check works as intended. The earlier finding about arbitrary ?title= text on the cached /api/og card is unchanged.
No logic, breaking-change, security or performance concerns found.
Automated review by Claude. Advisory only. A human approval is still required.
HDRUK-Claude
left a comment
There was a problem hiding this comment.
🤖 Review-E automated review
Low risk. The earlier finding is fixed: /api/og now ignores ?title= and only accepts ?type=&id=, getting the title and image from the same PAGE_TYPES loaders the pages use, so a card can only show what the public page shows. The new visibility checks (isActive, the CMS category check) match each page's notFound() condition, and getNewsArticle/getEventArticle are wrapped in React cache() so the CMS is queried once per request. I found no new bugs, breaking changes or data leaks in the new commits.
No logic, breaking-change, security or performance concerns found.
Automated review by Claude. Advisory only. A human approval is still required.
Screenshots / videos (if relevant)
Describe your changes
Public entity pages (datasets, collections, tools, data uses, publications, data custodians, custodian networks, and news and event articles) now build their metadata from the entity itself.
Shared links show the real name and a clean description instead of a generic title. Every page now emits canonical, Open Graph and Twitter card tags through
metaData(). Descriptions are cleaned of HTML, rich-text JSON and Markdown, cut to 160 characters at a word boundary, and fall back to the site description when empty.A new
/api/ogroute renders a branded 1200×630 share card with the page title and, where the entity has one, its logo. Logos are only fetched from the hostsnext/imagealready allows, and visitor cookies are never forwarded. Cards are cached for a day unless something failed to load.metadataBasecomes fromNEXT_PUBLIC_GATEWAY_URLso crawlers get absolute URLs.The unused
gateway-white-logo.svgis removed, and the details are documented indocs/ARCHITECTURE/page-metadata.md.Issue ticket link
https://hdruk.atlassian.net/browse/GAT-5649
Checklist before requesting a review