Browse Source

fix(feature/web-feeds): output last build date in rfc822 with 4-digit year

also output all dates using gmt offset with recommended "UT" timezone
Josh Habdas 7 months ago
parent
commit
4c86b4ac40
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
1 changed files with 15 additions and 17 deletions
  1. 15
    17
      layouts/_default/rss.xml

+ 15
- 17
layouts/_default/rss.xml View File

@@ -14,23 +14,21 @@
14 14
     <language>{{ . }}</language>{{ end }}{{ with .Site.Author }}
15 15
     <managingEditor>{{ .email }}{{ with .name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author }}
16 16
     <webMaster>{{ .email }}{{ with .name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
17
-    <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
18
-    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
19
-    {{ with .OutputFormats.Get "rss" }}
17
+    <copyright>{{ . }}</copyright>{{ end }}{{ if not now.IsZero }}
18
+    <lastBuildDate>{{ dateFormat "Mon, 02 Jan 2006 15:04:05" now.UTC | safeHTML }} UT</lastBuildDate>{{ end }}
19
+    {{ with .OutputFormats.Get "rss" -}}
20 20
       {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
21
-    {{ end }}
22
-    {{ range .Pages }}
23
-      <item>
24
-        <title>{{ .Title }}</title>
25
-        <link>{{ .Permalink }}</link>{{ if not .PublishDate.IsZero }}
26
-        <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>{{ end }}{{ if ne .Site.Params.hide_author true }}{{ if or (.Param "author") .Site.Author.email }}
27
-        <dc:creator>{{ default .Site.Author.email (.Param "author") }}{{ if and (not (.Param "author")) .Site.Author.name }} ({{ default (.Param "author") .Site.Author.name }}){{ end }}</dc:creator>{{ end }}{{ end }}
28
-        <guid>{{ .Permalink }}</guid>
29
-        <description>{{ .Summary | plainify }}</description>{{ range .Params.categories }}
30
-        <category domain="{{ printf "%s%s" ("/categories/" | absURL) (. | urlize ) }}">{{ . | title }}</category>{{ end }}{{ with .Resources.GetMatch "enclosure" }}{{ if .Params.length }}
31
-        <enclosure url="{{ .Permalink }}" length="{{ .Params.length }}" type="{{ .MediaType }}" />{{ end }}{{ end }}
32
-        <content:encoded>{{ "<![CDATA[" | safeHTML }}{{ .Content | plainify }}{{ "]]>" | safeHTML }}</content:encoded>
33
-      </item>
34
-    {{ end }}
21
+    {{- end }}{{ range .Pages }}
22
+    <item>
23
+      <title>{{ .Title }}</title>
24
+      <link>{{ .Permalink }}</link>{{ if not .PublishDate.IsZero }}
25
+      <pubDate>{{ dateFormat "Mon, 02 Jan 2006 15:04:05" .Date.UTC | safeHTML }} UT</pubDate>{{ end }}{{ if ne .Site.Params.hide_author true }}{{ if or (.Param "author") .Site.Author.email }}
26
+      <dc:creator>{{ default .Site.Author.email (.Param "author") }}{{ if and (not (.Param "author")) .Site.Author.name }} ({{ default (.Param "author") .Site.Author.name }}){{ end }}</dc:creator>{{ end }}{{ end }}
27
+      <guid>{{ .Permalink }}</guid>
28
+      <description>{{ .Summary | plainify }}</description>{{ range .Params.categories }}
29
+      <category domain="{{ printf "%s%s" ("/categories/" | absURL) (. | urlize ) }}">{{ . | title }}</category>{{ end }}{{ with .Resources.GetMatch "enclosure" }}{{ if .Params.length }}
30
+      <enclosure url="{{ .Permalink }}" length="{{ .Params.length }}" type="{{ .MediaType }}" />{{ end }}{{ end }}
31
+      <content:encoded>{{ "<![CDATA[" | safeHTML }}{{ .Content | plainify }}{{ "]]>" | safeHTML }}</content:encoded>
32
+    </item>{{ end }}
35 33
   </channel>
36 34
 </rss>

Loading…
Cancel
Save