MAke file_stat for local podcast files work if in subdir.

This commit is contained in:
Fredrik Jonsson 2023-08-28 20:11:26 +02:00
commit d0d2798bc9

View file

@ -49,7 +49,7 @@
{{ end -}}
<description>{{ .Content | html }}</description>
{{ if site.Params.Podcast.local | default true -}}
{{ with .Params.podcast.mp3 }}{{ $file_stat := os.Stat (path.Join "/static" (. | relURL)) }}<enclosure url="{{ if site.Params.Podcast.cdn }}{{ path.Join site.Params.Podcast.cdn (. | relURL) }}{{ else }}{{ . | absURL }}{{ end }}" length="{{ $file_stat.Size }}" type="audio/mpeg" />{{ end }}
{{ with .Params.podcast.mp3 }}{{ $file_stat := os.Stat (path.Join "/static" .) }}<enclosure url="{{ if site.Params.Podcast.cdn }}{{ path.Join site.Params.Podcast.cdn (. | relURL) }}{{ else }}{{ . | absURL }}{{ end }}" length="{{ $file_stat.Size }}" type="audio/mpeg" />{{ end }}
{{ else -}}
{{ with .Params.podcast.mp3 }}<enclosure url="{{ if site.Params.Podcast.cdn }}{{ add site.Params.Podcast.cdn (. | relURL) }}{{ else }}{{ . | absURL }}{{ end }}" type="audio/mpeg" />{{ end }}
{{ end -}}