Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for canonical links
Browse files Browse the repository at this point in the history
Add a `relcanonical: <URL>` item to the frontmatter and this will then make sure that the `<link rel="canonical" >` value is set properly.
davidgs committed Oct 15, 2024
1 parent 0d4d8a8 commit 739499b
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -8,7 +8,9 @@
{{ template "_internal/twitter_cards.html" . }}
<!------ ADD PAGE SPECIFIC HEADERS ------->
{{ block "header" . }} {{ end }}

{{ with .Params.relcanonical }}
{{ partial "misc/canonical.html" . }}
{{ end }}
<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
1 change: 1 addition & 0 deletions layouts/partials/misc/canoncial.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="canonical" href="{{ . | relLangURL }}" itemprop="url" />

0 comments on commit 739499b

Please sign in to comment.