> ## Content Index
> Fetch the complete content index at: https://getpublii.com/dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# {{canonicalLink}} helper

- URL: https://getpublii.com/dev/canonicallink-helper/
- Published: 2017-08-04T22:10:47.292Z
- Updated: 2024-02-08T11:50:19.352Z
- Description: 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"…
- Author: Tomasz Dziuda
- Tags: Helpers

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

Syntax:

```handlebars
{{canonicalLink}}
```

This helper has no additional params.

Example output:

```handlebars
<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](https://getpublii.com/docs/adding-editing-and-deleting-posts.html#adding-editing-and-deleting-posts).

**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.
