From 56d3c30a9830f728ac9a354e8b53b52a125be8f9 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Tue, 19 Jul 2022 14:56:32 +0200 Subject: [PATCH] Replace use of add with path.Join for buildig paths. --- layouts/partials/podcast.html | 2 +- layouts/podcast/rss.xml | 4 ++-- layouts/shortcodes/figure.html | 6 +++--- layouts/shortcodes/file.html | 2 +- layouts/shortcodes/img.html | 6 +++--- layouts/shortcodes/svg.html | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/layouts/partials/podcast.html b/layouts/partials/podcast.html index 034ed89..3fcd133 100644 --- a/layouts/partials/podcast.html +++ b/layouts/partials/podcast.html @@ -1,6 +1,6 @@ {{ $src := (.Params.podcast.mp3 | absURL) -}} {{ if site.Params.Podcast.cdn -}} -{{ $src = add site.Params.Podcast.cdn (.Params.podcast.mp3 | relURL) -}} +{{ $src = path.Join site.Params.Podcast.cdn (.Params.podcast.mp3 | relURL) -}} {{ end -}}
diff --git a/layouts/podcast/rss.xml b/layouts/podcast/rss.xml index 3b6f452..29c79e0 100644 --- a/layouts/podcast/rss.xml +++ b/layouts/podcast/rss.xml @@ -49,9 +49,9 @@ {{ end -}} {{ .Content | html }} {{ if site.Params.Podcast.local | default true -}} - {{ with .Params.podcast.mp3 }}{{ $file_stat := os.Stat (add "/static" (. | relURL)) }}{{ end }} + {{ with .Params.podcast.mp3 }}{{ $file_stat := os.Stat (path.Join "/static" (. | relURL)) }}{{ end }} {{ else -}} - {{ with .Params.podcast.mp3 }}{{ end }} + {{ with .Params.podcast.mp3 }}{{ end }} {{ end -}} {{ with .Params.podcast.duration }}{{ . }}{{ end }} {{ with .Params.podcast.image.src }}{{ $image := resources.Get . }}{{ end }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index b94c6a6..372bd6c 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -14,7 +14,7 @@ {{ $maxwidth := site.Params.imageMaxWidth -}} {{ $realwidth := 0 -}} {{ $realheight := 0 -}} -{{ if and $src (fileExists (add "/assets" $src)) -}} +{{ if and $src (fileExists (path.Join "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ if $size -}} {{ $image := $original.Resize $size -}} @@ -34,8 +34,8 @@ {{ $width = "" -}} {{ $height = "" -}} {{ end -}} -{{ else if and $src (fileExists (add "/static" $src)) -}} - {{ with (imageConfig (add "/static" $src)) -}} +{{ else if and $src (fileExists (path.Join "/static" $src)) -}} + {{ with (imageConfig (path.Join "/static" $src)) -}} {{ $realwidth = .Width -}} {{ $realheight = .Height -}} {{ end -}} diff --git a/layouts/shortcodes/file.html b/layouts/shortcodes/file.html index c52f532..44402fa 100644 --- a/layouts/shortcodes/file.html +++ b/layouts/shortcodes/file.html @@ -2,7 +2,7 @@ {{ $newtab := .Get "newtab" | default false -}} {{ $src := .Get "src" -}} {{ $text := .Get "text" -}} -{{ if and $src (fileExists (add "/assets" $src)) -}} +{{ if and $src (fileExists (path.Join "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ $src = $original.RelPermalink -}} {{ end -}} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index c745e66..546d6f8 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -10,7 +10,7 @@ {{ $maxwidth := site.Params.imageMaxWidth -}} {{ $realwidth := 0 -}} {{ $realheight := 0 -}} -{{ if and $src (fileExists (add "/assets" $src)) -}} +{{ if and $src (fileExists (path.Join "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ if $size -}} {{ $image := $original.Resize $size -}} @@ -30,8 +30,8 @@ {{ $width = "" -}} {{ $height = "" -}} {{ end -}} -{{ else if and $src (fileExists (add "/static" $src)) -}} - {{ with (imageConfig (add "/static" $src)) -}} +{{ else if and $src (fileExists (path.Join "/static" $src)) -}} + {{ with (imageConfig (path.Join "/static" $src)) -}} {{ $realwidth = .Width -}} {{ $realheight = .Height -}} {{ end -}} diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html index 5dee9f9..a32c21d 100644 --- a/layouts/shortcodes/svg.html +++ b/layouts/shortcodes/svg.html @@ -6,15 +6,15 @@ {{ $link := .Get "link" -}} {{ $src := .Get "src" -}} {{ $width := .Get "width" -}} -{{ if and $src (fileExists (add "/assets" $src)) -}} +{{ if and $src (fileExists (path.Join "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ if $inline -}} {{ $src = $original.Content -}} {{ else -}} {{ $src = $original.RelPermalink -}} {{ end -}} -{{ else if and $src $inline (fileExists (add "/static" $src)) -}} - {{ $src = readFile (add "/static" $src) -}} +{{ else if and $src $inline (fileExists (path.Join "/static" $src)) -}} + {{ $src = readFile (path.Join "/static" $src) -}} {{ end -}} {{ if and $width $height -}} {{ $width = int $width -}}