ComboStrap Page Metadata - Canonical URL

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.

How to set the canonical value ?

Manually

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

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

Automatically

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

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" />

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 !

Navigate to this page via its canonical URL!

or

Navigate to this page via its dokuwiki URL!

Usage

All external provider will use this value to refer to your page.

For instance:

For the Geek

The canonical is explained in depth in the RFC6956 - the Canonical Link Relation

Powered by ComboStrap