Skip to content

Commit c079875

Browse files
committed
partials/static-path.html: Use path.Join to assemble URL elements
1 parent 65f068f commit c079875

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

layouts/partials/static-path.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@
5555
{{- $l10n := index . "l10n" | default false }}
5656
{{- $abs := index . "abs" | default false }}
5757

58-
{{- with $file }}
59-
{{- $file = printf "/%s" . }}
60-
{{- end }}
61-
{{- $l10nDir := cond $l10n (printf "/%s" $page.Language.Lang) "" }}
58+
{{- $l10nDir := cond $l10n $page.Language.Lang "" }}
6259

6360
{{- $staticPath := false }}
6461

@@ -67,10 +64,14 @@
6764
{{- $pageBaseName := path.BaseName .RelPermalink }}
6865

6966
{{- if eq .Section "posts" }}
70-
{{- $path = printf "%s/posts/%s%s%s%s"
71-
$type
67+
{{- $dir := printf "%s%s"
7268
(cond .Draft "drafts/" (.Date.Format "2006-01-02-"))
7369
$pageBaseName
70+
}}
71+
{{- $path = path.Join
72+
$type
73+
"posts"
74+
$dir
7475
$l10nDir
7576
$file
7677
}}
@@ -87,7 +88,7 @@
8788
.Site.LanguagePrefix ""
8889
1
8990
}}
90-
{{- $path = printf "%s%s/%s%s%s"
91+
{{- $path = path.Join
9192
$type
9293
$pageURLParent
9394
$pageBaseName

0 commit comments

Comments
 (0)