ComboStrap Page Metadata - Canonical URL

1 - About

A canonical URL is an identifier for a web page that is defined through the canonical meta property.

It identifies uniquely a page in a domain.

The canonical value:

  • should never change (theoretically)
  • does not need to be the pagename
  • is always lowercase

The canonical component is a part of the SEO module.

3 - How to set the canonical value ?

3.1 - Manually

To set the canonical value, uses the frontmatter component and add the canonical property in the JSON document.

---json
{
    "canonical":"my:canonical:id"
}
---

3.2 - Automatically

This plugin can create a canonical value based on the last parts of a page ID. See ComboStrap Page Metadata - Automatic Canonical

4 - HTML HEAD properties

By setting a canonical value, you will get two head properties in your HTML page.

For instance:

  • if the canonical value is cat:post1
  • on a page hosted at example.com

the canonical head properties would become

<link rel="canonical" href="https://example.com/cat/post1" />
<meta property="og:url" content="https://example.com/cat/post1" />

5 - Demo

This page has the canonical value set to canonical:url and therefore is also available at this Canonical URL.

In dokuwiki, a red hyperlink means that the file does not exist but with the canonical feature, the page exists.

Try it your self !

or