METADATA · 2026-09-11

Give every page its own canonical URL

A small metadata decision that tells search engines which version of a page you want indexed.

Start with the page, not just the domain

A canonical URL identifies the preferred address for a piece of content. The homepage, documentation, and each article describe different things, so each should point to its own preferred URL.

Keep the URL consistent

Use your production origin, preserve the page path, and choose one trailing-slash convention. Tracking parameters can point back to the clean article URL when they do not change its content.

Inspect the response

Open the page source and find the canonical link. Compare it with the page you are visiting, its sitemap entry, and its Open Graph URL. They should describe the same page.

In this starter

pageMetadata(
  'Give every page its own canonical URL',
  '/examples/articles/canonical-urls'
)

This page is statically generated from src/content/articles.ts. Inspect its source response to see the generated metadata and JSON-LD.

Official reference: Read the documentation.