canonicalURI - speced/respec GitHub Wiki

canonicalURI

Type: string | "edDraft" | "TR" Default: undefined

Sets the <link rel="canonical"> URL for the document, helping search engines identify the authoritative version.

Basic usage

var respecConfig = {
  shortName: "payment-request",
  canonicalURI: "TR",
};
var respecConfig = {
  canonicalURI: "edDraft",
};
var respecConfig = {
  canonicalURI: "https://respec.org/docs/",
};

Keyword values

Value Generates
"TR" https://www.w3.org/TR/shortName/
"edDraft" The value of edDraftURI

Notes

  • Use "TR" for the published version to ensure search engines index the stable W3C TR/ URL rather than the Editor's Draft
  • Omit for documents where canonicalization isn't needed (e.g. unofficial drafts)