Extract canonical and alternate URL metadata from HTML.
Parsed HTML document or raw HTML string
Canonical metadata object
Extracts canonical URLs, language alternates, AMP versions, manifests, and app linking metadata.
// With parsed document (recommended for multiple extractions)const doc = parseHTML(htmlString);const canonical = extractCanonical(doc);// Or directly with HTML stringconst canonical = extractCanonical(htmlString); Copy
// With parsed document (recommended for multiple extractions)const doc = parseHTML(htmlString);const canonical = extractCanonical(doc);// Or directly with HTML stringconst canonical = extractCanonical(htmlString);
Extract canonical and alternate URL metadata from HTML.