Pain
Sharing any SSW Rules link (Teams, Slack, LinkedIn, X, Facebook) shows no preview image. The Next.js site emits zero Open Graph or Twitter Card meta tags β not even a generic default.
curl -sL https://www.ssw.com.au/rules/rules-to-better-code/ | grep -i 'og:\|twitter:'
# (no output)
generateMetadata() in app/[filename]/page.tsx only sets title, description and canonical. app/layout.tsx has no openGraph, no twitter, and no metadataBase.
β Figure: Bad example β rules links share as a bare title + URL, no image
For comparison, www.ssw.com.au sets a default on every page:
<meta property="og:image" content="https://assets.tina.io/8a7b77f2-cde8-44e7-a592-ebeb7e9dc437/ssw-default-og.jpg"/>
β
Figure: Good example β the main SSW site has a default OG image
Cause
This is a regression from the Gatsby β Next.js migration. The old src/components/head/head.js (deleted in 3c0fd0b "removing gatsby files") set the full set β og:title, og:description, og:type, og:site_name, og:url, og:image, twitter:card=summary_large_image, twitter:site, twitter:creator, fb:app_id β defaulting the image to /rules/assets/Open-Graph-images-Website-Rules.jpg. That asset now 404s too.
Suggested Solution
Use Next's Metadata API rather than hand-rolled tags:
- Set
metadataBase + default openGraph / twitter in app/layout.tsx so every route inherits them (rules, categories, latest-rules, search, user, archivedβ¦)
- Add a default OG image (1200Γ630) to
public/ β or point at the existing SSW default
- In each
generateMetadata(), override openGraph.title / description / url with the page's own values
Tasks
Notes
Related to #1379 (dynamic per-rule OG images). This PBI is just the baseline default β #1379 is the nicer per-rule version to build on top of it.
Pain
Sharing any SSW Rules link (Teams, Slack, LinkedIn, X, Facebook) shows no preview image. The Next.js site emits zero Open Graph or Twitter Card meta tags β not even a generic default.
generateMetadata()inapp/[filename]/page.tsxonly setstitle,descriptionandcanonical.app/layout.tsxhas noopenGraph, notwitter, and nometadataBase.β Figure: Bad example β rules links share as a bare title + URL, no image
For comparison, www.ssw.com.au sets a default on every page:
β Figure: Good example β the main SSW site has a default OG image
Cause
This is a regression from the Gatsby β Next.js migration. The old
src/components/head/head.js(deleted in3c0fd0b"removing gatsby files") set the full set βog:title,og:description,og:type,og:site_name,og:url,og:image,twitter:card=summary_large_image,twitter:site,twitter:creator,fb:app_idβ defaulting the image to/rules/assets/Open-Graph-images-Website-Rules.jpg. That asset now 404s too.Suggested Solution
Use Next's
MetadataAPI rather than hand-rolled tags:metadataBase+ defaultopenGraph/twitterinapp/layout.tsxso every route inherits them (rules, categories, latest-rules, search, user, archivedβ¦)public/β or point at the existing SSW defaultgenerateMetadata(), overrideopenGraph.title/description/urlwith the page's own valuesTasks
metadataBaseand defaultopenGraph+twittertoapp/layout.tsxopenGraphin thegenerateMetadata()functions (rules + categories first)Notes
Related to #1379 (dynamic per-rule OG images). This PBI is just the baseline default β #1379 is the nicer per-rule version to build on top of it.