This page demonstrates the canonical_url frontmatter option which allows you to specify a custom canonical URL for SEO purposes.
A canonical URL tells search engines which URL is the “official” version of a page when the same or similar content exists at multiple URLs. This helps prevent duplicate content issues and consolidates link equity.
Add the canonical_url property to your frontmatter:
---
title: My Page Title
canonical_url: https://example.com/the-canonical-version
---
This page uses:
canonical_url: https://example.com/the-canonical-version
This generates the following HTML in the <head>:
<link rel="canonical" href="https://example.com/the-canonical-version" />
Canonical URLs are useful when: