Download und feed so umgestellt, dass die Dateien auch über eine url definiert werden können

This commit is contained in:
mdn 2023-01-14 21:03:12 +01:00
parent 2a1daf1f52
commit 9219975673
2 changed files with 8 additions and 3 deletions

View file

@ -12,7 +12,13 @@
<item> <item>
<title>{{ .title }}</title> <title>{{ .title }}</title>
<description>{{ .comment }}</description> <description>{{ .comment }}</description>
<link>{{ (path.Join $baseDir .filename) | absURL }}</link> <link>
{{ if isset . "url" }}
{{- .url | safeURL -}}
{{ else }}
{{- (path.Join $baseDir .filename) | absURL -}}
{{ end }}
</link>
<author>{{ with $.Site.Author.email }}{{.}}{{end}}</author> <author>{{ with $.Site.Author.email }}{{.}}{{end}}</author>
<guid></guid> <guid></guid>
<pubDate>{{ (time .published).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ (time .published).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>

View file

@ -1,8 +1,7 @@
{{ $dataName := .Get "data" }} {{ $dataName := .Get "data" }}
{{ $baseDir := path.Dir .Page.File }}
<ul> <ul>
{{ range (index .Site.Data (split $dataName "/")) }} {{ range (index .Site.Data (split $dataName "/")) }}
<li><a href="{{ (path.Join $baseDir .filename) | absURL }}">{{ .title }}{{ with .filesize }} ({{ int (div (div . 1024) 1024) }} MB){{ end }}</a><br/>{{ .comment }}</li> <li><a href="{{ .url | safeURL }}">{{ .title }}{{ with .filesize }} ({{ int (div (div . 1024) 1024) }} MB){{ end }}</a><br/>{{ .comment }}</li>
{{ end }} {{ end }}
</ul> </ul>