Skip to content

Commit 452670b

Browse files
committed
chore(SEO): add canonicals for latest, point sitemap to latest
Related to camunda/team-automation-platform#286
1 parent ad4ae74 commit 452670b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

themes/camunda/layouts/_default/sitemap.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
<url>
66
{{- $permalink := .Permalink }}
77
{{- if ($.Site.Params.section.versions) }}
8-
{{- $latestVersion := (index $.Site.Params.section.versions 1) }}
9-
{{- $replacementPattern := print "${1}" $latestVersion "/${3}" }}
10-
{{- $permalink = $permalink | replaceRE `(\/manual\/)([^\/]*\/)(.*)` $replacementPattern }}
8+
{{- $replacementPattern := print "${1}" "latest" "/${4}" }}
9+
{{- $permalink = $permalink | replaceRE `(\/(manual|optimize)\/)([^\/]*\/)(.*)` $replacementPattern }}
1110
{{- end }}
1211
<loc>{{ $.Site.Params.canonicalBasePath }}{{ $permalink }}</loc>{{ if not .Lastmod.IsZero }}
1312
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}

themes/camunda/layouts/partials/header.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<meta name="keywords" content="camunda, open source, free, Apache License, Apache 2.0, workflow, BPMN, BPMN 2.0, camunda.org, bpm, BPMS, engine, platform, process, automation, community, documentation" />
2222
<meta name="author" content="Camunda 7 community" />
2323
{{ if ($.Site.Params.section.versions)}}
24-
{{ if (not (eq (index $.Site.Params.section.versions 1) $.Site.Params.section.version))}}
24+
{{ if (not (eq "latest" $.Site.Params.section.version))}}
2525
<meta name="robots" content="noindex" />
2626
{{ end }}
2727
{{ end }}
@@ -34,6 +34,13 @@
3434
{{ $styles := resources.Get "css/docs.css" | fingerprint }}
3535

3636
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
37+
<!-- add canonical link to latest if current version is not latest -->
38+
{{- $permalink := .Permalink }}
39+
{{- if ($.Site.Params.section.versions) }}
40+
{{- $replacementPattern := print "${1}" "latest" "/${4}" }}
41+
{{- $permalink = $permalink | replaceRE `(\/(manual|optimize)\/)([^\/]*\/)(.*)` $replacementPattern }}
42+
<link rel="canonical" href="{{ $.Site.Params.canonicalBasePath }}{{ $permalink }}" />
43+
{{- end }}
3744
</head>
3845
<body class="{{ .Params.bodyclass }}">
3946

0 commit comments

Comments
 (0)