rss.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {{- /* Generate RSS v2 with full page content. */ -}}
  2. {{- /* Upstream Hugo bug - RSS dates can be in future: https://github.com/gohugoio/hugo/issues/3918 */ -}}
  3. {{- $pages := .Data.Pages -}}
  4. {{- $limit := site.Config.Services.RSS.Limit -}}
  5. {{- if ge $limit 1 -}}
  6. {{- $pages = $pages | first $limit -}}
  7. {{- end -}}
  8. {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
  9. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  10. <channel>
  11. <title>{{ if ne .Title site.Title }}{{ with .Title }}{{.}} | {{ end }}{{end}}{{ site.Title }}</title>
  12. <link>{{ .Permalink }}</link>
  13. {{- with .OutputFormats.Get "RSS" }}
  14. {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
  15. {{ end -}}
  16. <description>{{ .Title | default site.Title }}</description>
  17. <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator>
  18. {{- with site.LanguageCode }}<language>{{.}}</language>{{end -}}
  19. {{- with site.Copyright }}<copyright>{{ replace (replace . "{year}" now.Year) "&copy;" "©" | plainify }}</copyright>{{end -}}
  20. {{- if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end -}}
  21. {{- if .Scratch.Get "og_image" }}
  22. <image>
  23. <url>{{ .Scratch.Get "og_image" }}</url>
  24. <title>{{ .Title | default site.Title }}</title>
  25. <link>{{ .Permalink }}</link>
  26. </image>
  27. {{end -}}
  28. {{ range $pages }}
  29. <item>
  30. <title>{{ .Title }}</title>
  31. <link>{{ .Permalink }}</link>
  32. <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
  33. <guid>{{ .Permalink }}</guid>
  34. <description>{{ .Content | html }}</description>
  35. </item>
  36. {{ end }}
  37. </channel>
  38. </rss>