Add Open Graph/SEO head tags and feed/sitemap redirects

Add Open Graph/SEO head tags and feed/sitemap redirects

#6 in tonybierman/dx-blog — merged 2026-05-29

Summary

The site shipped with no Open Graph, Twitter card, or description meta tags, and the conventional feed/sitemap names (/rss.xml, /site.xml) 404'd. This adds discoverability metadata and feed redirects.

Open Graph / SEO head tags (server-rendered)

Tags are rendered during SSR so crawlers and link-unfurlers — which don't run JS — actually see them. They're partitioned so nothing is set in two places (no duplicate tags):

  • GlobalMeta (main.rs): site-wide og:site_name + twitter:card.
  • HomeMeta (home.rs): <title>, description, og:type=website, og:title/og:description/og:url.
  • PostHead (reader.rs): article og:type/title/description/url/image, twitter:*, article:published_time (normalized to ISO 8601) + article:author.

PostDetail moves from use_resource to use_server_future (inside a SuspenseBoundary) so the post and its head tags resolve during SSR instead of rendering only a client-side skeleton — a bonus SEO win for the article body too. A new get_site_meta server fn bundles title/tagline/base-URL; absolute URLs come from SITE_URL via feeds::site_base (now pub).

Feed / sitemap redirects

The canonical endpoints are /feed.xml (Atom) and /sitemap.xml. Common guessed names previously fell through to the SPA catch-all and rendered the client 404. Added 301 redirects:

  • /rss.xml, /rss, /feed, /atom.xml/feed.xml
  • /site.xml/sitemap.xml

Verification

  • cargo fmt --check, clippy -D warnings (server), and cargo check on both server and wasm targets pass locally.
  • Verified the rendered tags in the SSR HTML (via curl, no JS) on the home page and a post page, and confirmed the redirects resolve to the real feed/sitemap.

[!NOTE] og:url/og:image use SITE_URL (already documented in .env.example). Unset in dev → http://localhost:3000; set it to the real origin in production.

🤖 Generated with Claude Code

Last updated 2026-05-30