docs: add canonical link ref
Adds a canonical link tag to doc pages to help SEO find the current version of documentation. Signed-off-by: Tim Jones <tim.jones@siderolabs.com>
This commit is contained in:
parent
0fe4a7832b
commit
e8cbedb05b
@ -1,5 +1,5 @@
|
||||
[build]
|
||||
command = "cd website && hugo --gc --minify"
|
||||
command = "cd website && hugo --gc --minify --baseURL $DEPLOY_PRIME_URL"
|
||||
publish = "website/public"
|
||||
|
||||
[build.environment]
|
||||
|
@ -4,3 +4,15 @@
|
||||
{{ if (findRE "<pre" .Content 1) }}
|
||||
<link rel="stylesheet" href="/css/clipboard.css">
|
||||
{{ end }}
|
||||
|
||||
<!--- https://developers.google.com/search/docs/advanced/crawling/consolidate-duplicate-urls?hl=en#rel-canonical-link-method -->
|
||||
{{ if .Section }}
|
||||
{{ $latest_version := .Site.Params.url_latest_version }}
|
||||
{{ $current_version := .Section | printf "/%s" }}
|
||||
{{ if ne $latest_version $current_version }}
|
||||
{{ $latest_doc := partial "doc_latest_version.html" . }}
|
||||
{{ if ne $latest_doc $latest_version }}
|
||||
<link rel="canonical" href="{{ $latest_doc | safeURL | absURL }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user