Skip to content

Commit

Permalink
Add support for canonical links (#1001)
Browse files Browse the repository at this point in the history
Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
davidgs and hossainemruz authored Oct 18, 2024
1 parent bc67ca1 commit 2f670db
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
{{ template "_internal/twitter_cards.html" . }}
<!------ ADD PAGE SPECIFIC HEADERS ------->
{{ block "header" . }} {{ end }}

<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
5 changes: 4 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{ define "header" }}
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}" />
{{ with .Params.relcanonical }}
<link rel="canonical" href="{{ . | relLangURL }}" itemprop="url" />
{{ end }}
{{ end }}

{{ define "navbar" }}
@@ -45,7 +48,7 @@ <h5 class="author-name">{{ partial "helpers/get-author-name.html" . }}</h5>
{{ else }}
<div style="margin-bottom: 80px;"></div>
{{ end }}

<div class="title">
<h1>{{ .Page.Title }}</h1>
</div>

0 comments on commit 2f670db

Please sign in to comment.