Skip to content

docs: add social images and better search metadata - #1383

Merged
dangreen merged 3 commits into
masterfrom
docs/website-seo
Dec 1, 2026
Merged

dangreen merged 3 commits into
masterfrom
docs/website-seo

Conversation

@dangreen

@dangreen dangreen commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Social images. Links to the website showed no image in social networks and chats, because the pages had no og:image. Every page now gets a 1200×630 image with the logo, its title and its description:
    • astro-og-canvas generates the images at build time at /og/<page id>.png (src/pages/og/[...slug].png.ts);
    • src/routeData.ts, a Starlight route middleware, adds the og:image tag to every page except the 404 page of Starlight, which is not in the collection;
    • the Inter font comes from @fontsource/inter, so the build downloads nothing;
    • CanvasKit draws no SVG, so src/assets/og-logo.png is the logo rasterized at the size the image shows it.
  • Titles and descriptions for search results. The component and example pages had titles such as "Line | react-chartjs-2" and descriptions such as "Description of Line component from react-chartjs-2.":
    • the 26 component and example pages and the two overview pages get a <title> with the words people search for, such as "React Line Chart Example | react-chartjs-2". It is set through head in the frontmatter, as on the home page, so the headings and the sidebar stay the same;
    • their descriptions say what each page shows;
    • the FAQ overview and six older docs pages get better descriptions too.
  • npm. The description of the package now matches the website and the repository, and the keywords name React and the chart types. npm search ranks packages by them. They go out with the next release.

Checked locally

  • The website builds with 0 errors, and oxlint passes.
  • All 47 pages have an og:image that points to a generated image. The 404 page and the redirect pages have none, and the sitemap lists no images.
  • The text of every image ends above the bottom padding, including the longest FAQ titles: the lowest row of text is at 563 of 630 px.
  • astro dev serves the images at the same URLs.
  • The squash message passes commitlint.

🤖 Generated with Claude Code

Links to the website showed no image in social networks and chats: the pages had no og:image.
Every page now gets one with its title and description, generated at build time with
astro-og-canvas and the Inter font from npm, so the build fetches nothing.
The component and example pages had titles such as "Line" and descriptions such as
"Description of Line component from react-chartjs-2.". They get titles with the words people
search for, such as "React Line Chart Example", and descriptions of what each page shows.
The overview pages and the older docs pages get better descriptions too.
npm search ranks packages by their keywords and description, which named neither React nor
the chart types.
@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.97%. Comparing base (6911b42) to head (925e85b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1383   +/-   ##
=======================================
  Coverage   93.97%   93.97%           
=======================================
  Files           3        3           
  Lines          83       83           
  Branches       20       20           
=======================================
  Hits           78       78           
  Misses          3        3           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dangreen
dangreen merged commit 87b8343 into master Dec 1, 2026
11 checks passed
@dangreen
dangreen deleted the docs/website-seo branch December 1, 2026 16:07
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