Skip to content

Commit cc73fa3

Browse files
authored
Merge pull request #3 from nkdAgility/update-canonical
Update canonical
2 parents 37d0324 + 5217b64 commit cc73fa3

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ jobs:
233233
name: "Publish Site"
234234
runs-on: ubuntu-latest
235235
needs: [Setup, BuildSite]
236-
if: ${{ success() }}
236+
if: ${{ false }}
237237
outputs:
238238
static_web_app_url: ${{ steps.azureDeploy.outputs.static_web_app_url }}
239239
steps:

module/layouts/_partials/components/seo/guide-version-links.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@
2121
{{- end -}}
2222
{{- end -}}
2323

24+
{{- /* Add hreflang links for all available languages of this version */ -}}
25+
{{- range .Site.Sites -}}
26+
{{- $langCode := .Language.Lang -}}
27+
{{- $siteVersion := "" -}}
28+
29+
{{- /* Try to find the equivalent page in this language site */ -}}
30+
{{- $versionPath := printf "%s/%s" $.Section $currentVersion -}}
31+
{{- $langVersionPage := .GetPage $versionPath -}}
32+
33+
{{- /* If specific version not found and this is latest, try section root */ -}}
34+
{{- if and (not $langVersionPage) (eq $currentVersion $latestVersion) -}}
35+
{{- $langVersionPage = .GetPage $.Section -}}
36+
{{- end -}}
37+
38+
{{- /* Add hreflang link if page exists in this language */ -}}
39+
{{- if $langVersionPage -}}
40+
<link rel="alternate" hreflang="{{ $langCode }}" href="{{ $.Site.Params.siteProdUrl }}{{ $langVersionPage.RelPermalink }}" />
41+
{{- end -}}
42+
{{- end -}}
43+
2444
{{- /* Add "latest" rel link if this is not the latest version */ -}}
2545
{{- if ne $currentVersion $latestVersion -}}
2646
{{- $sectionPage := $.Site.GetPage $.Section -}}

module/layouts/_partials/components/seo/guide-version-meta.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
{{- /* Robots meta tag for non-latest versions */ -}}
2121
{{- if and $isGuide $currentVersion (not $isLatestVersion) -}}
22-
<meta name="robots" content="noindex, follow" />
22+
<meta name="robots" content="index, follow" />
2323
<meta name="description" content="Historical version ({{ $currentVersion }}) of {{ .Title }}. For the latest version, visit the main guide page." />
2424
{{- end -}}
2525

module/layouts/_partials/functions/get-canonical-url.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
{{- if eq .Type "guide" -}}
1111
{{- $currentVersion := partial "functions/get-guide-version.html" . -}}
1212
{{- if $currentVersion -}}
13-
{{- $latestVersion := partial "functions/get-latest-version" . -}}
14-
{{- if eq $currentVersion $latestVersion -}}
15-
{{- /* For latest version, canonical should be the section root */ -}}
16-
{{- $sectionPage := .Site.GetPage .Section -}}
17-
{{- if $sectionPage -}}
18-
{{- $canonicalUrl = $sectionPage.RelPermalink -}}
19-
{{- else -}}
20-
{{- $canonicalUrl = printf "/%s/" .Section -}}
21-
{{- end -}}
13+
{{- /* For ALL guide versions, canonical should be the section root */ -}}
14+
{{- $sectionPage := .Site.GetPage .Section -}}
15+
{{- if $sectionPage -}}
16+
{{- $canonicalUrl = $sectionPage.RelPermalink -}}
17+
{{- else -}}
18+
{{- $canonicalUrl = printf "/%s/" .Section -}}
2219
{{- end -}}
2320
{{- end -}}
2421
{{- end -}}

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Scrum Guides Expansion Pack
1+
# Hugo Guides - Open Extension
22

3-
This repository contains an expansion pack for the Scrum Guide, providing additional resources, examples, and explanations to enhance understanding of Scrum practices.
3+
This repository provides an engine for guides in Hugo.

0 commit comments

Comments
 (0)