Skip to content

Commit 989969e

Browse files
authored
Update canonical URL handling for Giscus (#638)
2 parents 06fd5dd + 592d9b0 commit 989969e

5 files changed

Lines changed: 30 additions & 15 deletions

File tree

BFF/v2/docs/themes/hugo-theme-learn/layouts/partials/canonical.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{{ if .Page.Params.NewContentUrl }}
44
{{ $url = .Page.Params.NewContentUrl }}
55
{{ end }}
6-
<link rel="canonical" href="{{ $url }}" />
7-
<meta name="giscus:backlink" content="{{ $url }}">
8-
{{ end}}
6+
<link rel="canonical" href="{{ $url }}" />
7+
<meta name="giscus:backlink" content="{{ $url }}">
8+
{{ else }}
9+
<link rel="canonical" href="{{ .Permalink }}" />
10+
<meta name="giscus:backlink" content="{{ .Permalink }}">
11+
{{ end }}

BFF/v3/docs/themes/hugo-theme-learn/layouts/partials/canonical.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{{ if .Page.Params.NewContentUrl }}
44
{{ $url = .Page.Params.NewContentUrl }}
55
{{ end }}
6-
<link rel="canonical" href="{{ $url }}" />
7-
<meta name="giscus:backlink" content="{{ $url }}">
8-
{{ end}}
6+
<link rel="canonical" href="{{ $url }}" />
7+
<meta name="giscus:backlink" content="{{ $url }}">
8+
{{ else }}
9+
<link rel="canonical" href="{{ .Permalink }}" />
10+
<meta name="giscus:backlink" content="{{ .Permalink }}">
11+
{{ end }}

IdentityServer/v5/docs/themes/hugo-theme-learn/layouts/partials/canonical.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{{ if .Page.Params.NewContentUrl }}
44
{{ $url = .Page.Params.NewContentUrl }}
55
{{ end }}
6-
<link rel="canonical" href="{{ $url }}" />
7-
<meta name="giscus:backlink" content="{{ $url }}">
8-
{{ end}}
6+
<link rel="canonical" href="{{ $url }}" />
7+
<meta name="giscus:backlink" content="{{ $url }}">
8+
{{ else }}
9+
<link rel="canonical" href="{{ .Permalink }}" />
10+
<meta name="giscus:backlink" content="{{ .Permalink }}">
11+
{{ end }}

IdentityServer/v6/docs/themes/hugo-theme-learn/layouts/partials/canonical.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{{ if .Page.Params.NewContentUrl }}
44
{{ $url = .Page.Params.NewContentUrl }}
55
{{ end }}
6-
<link rel="canonical" href="{{ $url }}" />
7-
<meta name="giscus:backlink" content="{{ $url }}">
8-
{{ end}}
6+
<link rel="canonical" href="{{ $url }}" />
7+
<meta name="giscus:backlink" content="{{ $url }}">
8+
{{ else }}
9+
<link rel="canonical" href="{{ .Permalink }}" />
10+
<meta name="giscus:backlink" content="{{ .Permalink }}">
11+
{{ end }}

IdentityServer/v7/docs/themes/hugo-theme-learn/layouts/partials/canonical.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{{ if .Page.Params.NewContentUrl }}
44
{{ $url = .Page.Params.NewContentUrl }}
55
{{ end }}
6-
<link rel="canonical" href="{{ $url }}" />
7-
<meta name="giscus:backlink" content="{{ $url }}">
8-
{{ end}}
6+
<link rel="canonical" href="{{ $url }}" />
7+
<meta name="giscus:backlink" content="{{ $url }}">
8+
{{ else }}
9+
<link rel="canonical" href="{{ .Permalink }}" />
10+
<meta name="giscus:backlink" content="{{ .Permalink }}">
11+
{{ end }}

0 commit comments

Comments
 (0)