feat: add canonical url support (#650)
When you want to publish content that is already published on a different site. You need to reference a canonical url of the original content.
By defining the `canonicalUrl` in the front matter definition the canonical url is set in the headers.
| | |
| | | With hugo 0.87.0 and above, you can also use predefined layout, like `:date_full`, and it will output localized dates or times. |
| | | See hugo's documentation of the [`time.Format` function](https://gohugo.io/functions/dateformat/) for more details. |
| | | |
| | | ### Using a canonical url |
| | | |
| | | When you want to publish content that is already published on a different site. You need to reference a canonical url of the original content. |
| | | By defining the `canonicalUrl` in the front matter definition the canonical url is set in the headers. |
| | | |
| | | ``` |
| | | canonicalUrl: https://mydomain.com/path-to-the-oringinal-content/ |
| | | ``` |
| | | |
| | | ### Nearly finished |
| | | |
| | |
| | | {{ end }} |
| | | {{ end }} |
| | | |
| | | {{ if .Params.canonicalUrl }} |
| | | <link rel="canonical" href="{{ .Params.canonicalUrl }}"> |
| | | {{ else }} |
| | | <link rel="canonical" href="{{ .Permalink }}"> |
| | | {{ end }} |
| | | |
| | | {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}} |
| | | {{- template "_internal/opengraph.html" . -}} |
| | | {{- template "_internal/schema.html" . -}} |