Add rel="canonical" link tag (#732)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.26, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.26, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, macOS-latest) (push) Has been cancelled
Go CI / Build (1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, windows-latest) (push) Has been cancelled

This commit is contained in:
Thomas
2026-06-26 02:59:41 +07:00
committed by GitHub
parent cff18e9078
commit 2a5a054167
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -158,6 +158,7 @@ func dataInit(next Handler) Handler {
} }
ctx.SetData("baseHttpUrl", baseHttpUrl) ctx.SetData("baseHttpUrl", baseHttpUrl)
ctx.SetData("canonicalUrl", baseHttpUrl+ctx.Request().URL.Path)
return next(ctx) return next(ctx)
} }
+4
View File
@@ -9,6 +9,10 @@
<base href="{{ $.c.ExternalUrl }}" /> <base href="{{ $.c.ExternalUrl }}" />
{{ if .canonicalUrl }}
<link rel="canonical" href="{{ .canonicalUrl }}" />
{{ end }}
<script> <script>
window.opengist_base_url = "{{ $.c.ExternalUrl }}"; window.opengist_base_url = "{{ $.c.ExternalUrl }}";
window.opengist_locale = "{{ .locale.Code }}".substring(0, 2); window.opengist_locale = "{{ .locale.Code }}".substring(0, 2);