Download

{{canonicalLink}} helper

Generates link element with URL to the canonical version of the specific page.

Syntax:

{{canonicalLink}}

This helper has no additional params.

Example output:

<link rel="canonical" href="https://example.com/page-slug/">

The {{canonicalLink}} helper should be used in the <head> section of the website.

Canonical links are used to recognise the base URL for a group of pages with the same content, but available under different URLs. It is a simple way to avoid duplicate content which can affect your website SEO. You can also set a custom canonical URL under post settings.

This helper do the following operations:

If the subpage is set to be not indexed - it returns empty value as canonical URLs are unnecessary when the page is set to noindex.

For other cases it returns the current URL or URL overrided under post settings.

What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website