Skip to content

Commit 967e3c8

Browse files
Added rel canonical to the lts version
Signed-off-by: Ihor Aleksandrychiev <[email protected]>
1 parent 7d33017 commit 967e3c8

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

generator/build/main.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ if [ "$BRANCH" = "lts" ]; then
128128
sed -i '/^title = /s/ %branch%//' "$CONFIG_TOML"
129129
# Replace %branch% in searchBaseUrl with "lts"
130130
sed -i '/^searchBaseUrl = /s/%branch%/lts/' "$CONFIG_TOML"
131+
# Set isLTS to true
132+
sed -i 's/isLTS = false/isLTS = true/' "$CONFIG_TOML"
131133
# Then replace remaining %branch% with LTS_VERSION
132134
sed -i "s/%branch%/$LTS_VERSION/g" "$CONFIG_TOML"
133135
else

hugo/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ repositoryUrl = "https://github.com/cfengine/documentation"
1515
searchBaseUrl = "/docs/search/%branch%/"
1616
searchUrlPrefix = ".."
1717
domain = "docs.cfengine.com"
18+
isLTS = false
1819

1920
[params.cfengine]
2021
branch = "%branch%"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ if not .Site.Params.isLTS }}
2+
{{ $currentPath := .RelPermalink }}
3+
{{ $canonicalURL := replace $currentPath (printf "/docs/%s/" .Site.Params.branch) "/docs/lts/" }}
4+
<link rel="canonical" href="https://{{ .Site.Params.domain }}{{ $canonicalURL }}" />
5+
{{ end }}

0 commit comments

Comments
 (0)