Skip to content

Canonical URLs

Laura Kalbag edited this page May 23, 2023 · 1 revision

Sometimes we use pages that originated elsewhere. This is most commonly done with blog posts (with permission!) When we duplicate web content in this way, we don’t want search engines to penalize us for copying content without permission. To tell the search engine that we know this is duplicate content, we point to the page’s original (canonical) URL in the <head>’s <meta> information.

To do this in Docusaurus, we add the <meta> element into the page content. Docusaurus will then add that <meta> element into the page’s <head> on build.

Example:

---
title: "XState: version 4.7 and the future"
---

<head>
  <link rel="canonical" href="https://dev.to/davidkpiano/xstate-version-4-7-and-the-future-2ehk" />
</head>

// … rest of the page content in markdown …