Skip to content

Improve SEO metadata consistency and add structured-data fallbacks#1024

Open
AvdLee wants to merge 1 commit into
masterfrom
codex/audit-and-enhance-seo-metadata-consistency
Open

Improve SEO metadata consistency and add structured-data fallbacks#1024
AvdLee wants to merge 1 commit into
masterfrom
codex/audit-and-enhance-seo-metadata-consistency

Conversation

@AvdLee
Copy link
Copy Markdown
Owner

@AvdLee AvdLee commented May 24, 2026

Motivation

  • Fix inconsistent canonical and image URLs used across pages by enforcing absolute, production-safe metadata URLs and consistent trailing-slash behavior based on site config.
  • Improve social previews and Twitter/Open Graph metadata coverage with centralized fallbacks so pages without explicit overrides still produce valid previews.
  • Make JSON-LD output more consistent and lightweight by ensuring Organization schema is always present and avoiding noisy runtime date generation for non-article pages.
  • Keep changes incremental and low-risk by reusing existing SEO/Head/StructuredData components without changing rendering or build pipelines.

Description

  • Added a small reusable helper src/lib/utils/seo.ts exposing toAbsoluteUrl and normalizeCanonicalUrl to produce absolute URLs and normalized canonical links.
  • Hardened src/layouts/components/SEO.astro to use normalizeCanonicalUrl for canonical normalization, and a robust OG image fallback chain (page override → site meta image → app icon) and switched Twitter tag attributes to name= for consistency.
  • Extended src/layouts/components/StructuredData.astro to always emit a lightweight Organization schema and made WebPage date fields optional while removing runtime new Date() for non-article page types.
  • Updated docs Starlight head src/components/starlight/Head.astro to add og:url, a canonical link, site-wide OG/Twitter image fallbacks, and an SSR-compatible BreadcrumbList JSON-LD for /docs/* routes derived from path segments.

Testing

  • Ran lint: cd docs && npm run lint — passed.
  • Ran format check: cd docs && npm run format:check — passed (Prettier auto-fixed then rechecked).
  • Ran typecheck: cd docs && npm run typecheck — passed (one existing TS hint unrelated to these changes).
  • Ran build: cd docs && npm run build — failed in this environment due to an external WordPress API fetch in src/pages/blog/[slug].astro returning ENETUNREACH, not caused by the metadata changes.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant