diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-22 22:51:17 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-22 22:51:17 +0200 |
| commit | 82d9181cb40cba312ea824d91d1d358c3b657190 (patch) | |
| tree | ee699830dc2f65fb79d73b15a8525582103218e3 | |
| parent | 2187073396f7a54f6cfa6835e992d962cc4f0fb1 (diff) | |
| download | gohugo-theme-ed-82d9181cb40cba312ea824d91d1d358c3b657190.tar.gz | |
Reformat feeds
| -rw-r--r-- | layouts/_default/list.atom.xml | 37 | ||||
| -rw-r--r-- | layouts/_default/list.feed.xml | 20 |
2 files changed, 23 insertions, 34 deletions
diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index dc14748..5629534 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -13,7 +13,7 @@ {{- $limit := site.Params.feedSize | default 25 -}} {{- $pages = $pages | first $limit -}} -{{- safeHTML "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" }} +{{- safeHTML "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" }} <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="{{ site.LanguageCode }}"> {{ printf `<title type="html"><![CDATA[%s]]></title>` (partial "title.html" .) | safeHTML }} {{ with site.Params.description }}{{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}{{ end }} @@ -25,30 +25,24 @@ {{- end -}} {{- end }} {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}{{ $logo = $logo.Resize "96x96" }}<icon>{{ $logo.Permalink | absURL }}</icon> - <logo>{{ $logo.Permalink | absURL }}</logo> - {{ with site.Author.name }}<author> + <logo>{{ $logo.Permalink | absURL }}</logo>{{ with site.Author.name }} + <author> {{ printf `<name type="html"><![CDATA[%s]]></name>` . | safeHTML }} {{ with site.Author.email }}<email>{{ . | html }}</email>{{ end }} - </author>{{ end }} - {{ with site.Params.Copyright }} - {{- $copyright := replace . "{year}" now.Year -}} - {{- $copyright = replace $copyright "©" "©" }}<rights>{{ $copyright | plainify }}</rights>{{ end }} - <generator uri="https://gohugo.io" version="{{ hugo.Version }}">Hugo</generator> - {{ if not site.LastChange.IsZero }}<updated>{{ site.LastChange.UTC.Format site.Params.dateFormatFeed }}</updated>{{ end }} - {{ $uuid := sha1 (site.BaseURL | absURL) }}<id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id> - {{- range $pages }} + </author>{{ end }}{{ with site.Params.Copyright }}{{ $copyright := replace . "{year}" now.Year }}{{ $copyright = replace $copyright "©" "©" }} + <rights>{{ $copyright | plainify }}</rights>{{ end }} + <generator uri="https://gohugo.io" version="{{ hugo.Version }}">Hugo</generator>{{ if not site.LastChange.IsZero }} + <updated>{{ site.LastChange.UTC.Format site.Params.dateFormatFeed }}</updated>{{ end }}{{ $uuid := sha1 (site.BaseURL | absURL) }} + <id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id>{{- range $pages }} <entry> {{- $url := .Permalink | absURL }}{{ $uuid := sha1 (.Permalink | absURL) }}{{ $page := . }} - <category term="{{ .Section }}" /> - {{ range (.GetTerms "tags") }}<category term="{{ .LinkTitle }}" />{{ end }} + <category term="{{ .Section }}" />{{ range (.GetTerms "tags") }} + <category term="{{ .LinkTitle }}" />{{ end }} <link rel="alternate" type="type/html" href="{{ $url }}?utm_source=atom_feed" /> - {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }} - {{/* rel=related: See https://validator.w3.org/feed/docs/atom.html#link */}} - {{- range first 5 (site.RegularPages.Related .) }} - <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" /> - {{- end }} - <published>{{ (.PublishDate.Format site.Params.dateFormatFeed) | html }}</published> - {{ if ne .Date .Lastmod }}<updated>{{ .Lastmod.UTC.Format site.Params.dateFormatFeed }}</updated>{{ end }} + {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}{{ range first 5 (site.RegularPages.Related .) }} + <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" />{{ end }} + <published>{{ (.PublishDate.Format site.Params.dateFormatFeed) | html }}</published>{{ if ne .Date .Lastmod }} + <updated>{{ .Lastmod.UTC.Format site.Params.dateFormatFeed }}</updated>{{ end }} <id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id> {{ if .Params.author }} {{- $author_type := (printf "%T" .Params.author) }} @@ -65,6 +59,5 @@ {{- end }} {{ end }} {{ printf `<summary type="html"><![CDATA[%s]]></summary>` .Summary | safeHTML }} - </entry> - {{- end }} + </entry>{{ end }} </feed> diff --git a/layouts/_default/list.feed.xml b/layouts/_default/list.feed.xml index c55b19b..8a80edf 100644 --- a/layouts/_default/list.feed.xml +++ b/layouts/_default/list.feed.xml @@ -13,7 +13,7 @@ {{- $limit := site.Params.feedSize | default 25 -}} {{- $pages = $pages | first $limit -}} -{{- safeHTML "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" }} +{{- safeHTML "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" }} <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" @@ -43,21 +43,17 @@ {{- end -}} {{- end }} {{ with site.Params.description }}{{ printf `<description type="html"><![CDATA[%s]]></description>` . | safeHTML }}{{ end }} - <generator>Hugo {{ hugo.Version }}</generator> - {{ with site.Author.name }}{{ printf `<dc:creator type="html"><![CDATA[%s]]></dc:creator>` . | safeHTML }}{{ end }} - {{ with site.LanguageCode }}<language>{{ . }}</language>{{ end }} - {{ with site.Params.Copyright }} - {{- $copyright := replace . "{year}" now.Year -}} - {{- $copyright = replace $copyright "©" "©" }}<copyright>{{ $copyright | plainify }}</copyright>{{ end }} - {{ if not site.LastChange.IsZero }}<lastBuildDate>{{ site.LastChange.UTC.Format site.Params.dateFormatRFC822Z | html }}</lastBuildDate>{{ end }} - {{ $feedsize := site.Params.feedSize | default 25 }} - {{- range $pages }} + <generator>Hugo {{ hugo.Version }}</generator>{{ with site.Author.name }} + {{ printf `<dc:creator type="html"><![CDATA[%s]]></dc:creator>` . | safeHTML }}{{ end }}{{ with site.LanguageCode }} + <language>{{ . }}</language>{{ end }}{{ with site.Params.Copyright }}{{ $copyright := replace . "{year}" now.Year }}{{ $copyright = replace $copyright "©" "©" }} + <copyright>{{ $copyright | plainify }}</copyright>{{ end }}{{ if not site.LastChange.IsZero }} + <lastBuildDate>{{ site.LastChange.UTC.Format site.Params.dateFormatRFC822Z | html }}</lastBuildDate>{{ end }}{{- range $pages }} <item> {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }} <link>{{ .Permalink | absURL }}?utm_source=rss_feed</link> <pubDate>{{ .PublishDate.UTC.Format site.Params.dateFormatRFC822Z | html }}</pubDate> - <category>{{ .Section }}</category> - {{ range (.GetTerms "tags") }}<category>{{ .LinkTitle }}</category>{{end}} + <category>{{ .Section }}</category>{{ range (.GetTerms "tags") }} + <category>{{ .LinkTitle }}</category>{{end}} <guid isPermaLink="false">{{ md5 .Permalink }}</guid> {{ printf `<description type="html"><![CDATA[%s]]></description>` .Summary | safeHTML }} </item> |
