]> git.dujemihanovic.xyz Git - dujemihanovic.xyz.git/blobdiff - layouts/rss.xml
Switch to Atom feed
[dujemihanovic.xyz.git] / layouts / rss.xml
index 18d4ff6bccba38ce804c9fcd520ba8c407a476ef..b43900f23bb8dbc8fdc8ce907ab0b647b8efff04 100644 (file)
@@ -1,29 +1,34 @@
-{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
-<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
-  <channel>
-    <title>{{ .Site.Title }}</title>
-    <link>{{ .Permalink }}</link>
-    <description>Recent content on {{ .Site.Title }}</description>
-    <generator>Hugo -- gohugo.io</generator>
-    <language>{{ site.Language.LanguageCode }}</language>{{ with .Site.Author.email }}
-    <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
-    <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
-    <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
-    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
-    {{- with .OutputFormats.Get "RSS" -}}
-    {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
-    {{- end -}}
-    {{ with .Site.GetPage "posts/" }}
-    {{ range .Pages | first .Site.Config.Services.RSS.Limit }}
-    <item>
-      <title>{{ .Title }}</title>
-      <link>{{ .Permalink }}</link>
-      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
-      {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
-      <guid>{{ .Permalink }}</guid>
-      <description>{{ .Content | html }}</description>
-    </item>
-    {{ end }}
-    {{ end }}
-  </channel>
-</rss>
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
+<feed xmlns="http://www.w3.org/2005/Atom">
+       <title>{{ .Site.Title }}</title>
+       <id>{{ .Permalink }}</id>
+       {{ $lastmod := 0 }}
+       {{ range (.Site.GetPage "/posts").Pages }}
+               {{ if gt .Lastmod $lastmod }}
+                       {{ $lastmod = .Lastmod }}
+               {{ end }}
+       {{ end }}
+       <updated>{{ $lastmod.Format "2006-01-02T15:04:05Z" }}</updated>
+       <link href="{{ .Permalink }}"/>
+       <link rel="self" href="{{ (.OutputFormats.Get "RSS").Permalink }}"/>
+       <author>
+               <name>{{ $.Site.Author.name }}</name>
+               <email>{{ $.Site.Author.email }}</email>
+               <uri>{{ .Permalink }}</uri>
+       </author>
+       <generator uri="https://gohugo.io/">Hugo</generator>
+
+       {{ with $.Site.GetPage "posts/" }}
+       {{ range first .Site.Config.Services.RSS.Limit .Pages }}
+       <entry>
+               <id>{{ .Permalink }}</id>
+               <link rel="alternate" href="{{ .RelPermalink }}"/>
+               <title>{{ .Title }}</title>
+               <updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z" }}</updated>
+               <published>{{ .PublishDate.Format "2006-01-02T15:04:05Z" }}</published>
+               <content type="html">{{ .Content | html }}</content>
+               <summary type="html">{{ .Summary | html }}</summary>
+       </entry>
+       {{ end }}
+       {{ end }}
+</feed>