diff --git a/site/layouts/_default/examples.html b/site/layouts/_default/examples.html
index 82e57c1b57..19aad368d6 100644
--- a/site/layouts/_default/examples.html
+++ b/site/layouts/_default/examples.html
@@ -14,7 +14,7 @@
{{- end }}
- {{- $colorModeJS := printf "/docs/%s/assets/js/color-modes.js" $.Site.Params.docs_version -}}
+ {{- $colorModeJS := urls.JoinPath "/docs" $.Site.Params.docs_version "assets/js/color-modes.js" -}}
{{ partial "stylesheet" . }}
diff --git a/site/layouts/partials/docs-sidebar.html b/site/layouts/partials/docs-sidebar.html
index e7b5576874..891a47306a 100644
--- a/site/layouts/partials/docs-sidebar.html
+++ b/site/layouts/partials/docs-sidebar.html
@@ -28,7 +28,7 @@
{{- range $doc := $group.pages -}}
{{- $doc_slug := $doc.title | urlize -}}
{{- $is_active := and $is_active_group (eq $page_slug $doc_slug) -}}
- {{- $href := printf "/docs/%s/%s/%s/" $.Site.Params.docs_version $group_slug $doc_slug }}
+ {{- $href := urls.JoinPath "/docs" $.Site.Params.docs_version $group_slug $doc_slug "/" }}
{{ $doc.title }}
{{- end }}
diff --git a/site/layouts/partials/docs-versions.html b/site/layouts/partials/docs-versions.html
index 7bb7231ef3..c465d02e90 100644
--- a/site/layouts/partials/docs-versions.html
+++ b/site/layouts/partials/docs-versions.html
@@ -5,9 +5,9 @@
{{- $versions_link := "" -}}
{{- if and (eq .Layout "docs") (eq $page_version .Site.Params.docs_version) -}}
- {{- $versions_link = printf "%s/%s/" $group_slug $page_slug -}}
+ {{- $versions_link = urls.JoinPath $group_slug $page_slug "/" -}}
{{- else if (eq .Layout "single") -}}
- {{- $versions_link = printf "%s/" $page_slug -}}
+ {{- $versions_link = urls.JoinPath $page_slug "/" -}}
{{- end -}}
{{- $added_in_51 := eq (string .Page.Params.added.version) "5.1" -}}
diff --git a/site/layouts/partials/header.html b/site/layouts/partials/header.html
index ff080901e2..ba58893286 100644
--- a/site/layouts/partials/header.html
+++ b/site/layouts/partials/header.html
@@ -17,7 +17,7 @@
{{- end }}
-{{- $colorModeJS := printf "/docs/%s/assets/js/color-modes.js" $.Site.Params.docs_version -}}
+{{- $colorModeJS := urls.JoinPath "/docs" $.Site.Params.docs_version "assets/js/color-modes.js" -}}
{{ partial "stylesheet" . }}
diff --git a/site/layouts/partials/home/plugins.html b/site/layouts/partials/home/plugins.html
index ab48d9bc60..e28ae1bf1f 100644
--- a/site/layouts/partials/home/plugins.html
+++ b/site/layouts/partials/home/plugins.html
@@ -50,6 +50,7 @@
{{- range $plugin := .Site.Data.plugins -}}
+ {{- /* TODO we should use urls.JoinPath here too, but the links include `#` which gets escaped */ -}}
{{- $href := printf "/docs/%s/%s" $.Site.Params.docs_version $plugin.link }}