jk.nipponalba.scot website https://jk.nipponalba.scot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

92 lines
4.5 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. {{ printf `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}}
  2. <feed xmlns="http://www.w3.org/2005/Atom"{{ with site.LanguageCode }} xml:lang="{{ . }}"{{ end }}>
  3. <generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
  4. <link href="http://pubsubhubbub.superfeedr.com/" rel="hub"/>
  5. {{- $title := site.Title -}}
  6. {{- with .Title -}}
  7. {{- if (not (eq . site.Title)) -}}
  8. {{- $title = printf `%s %s %s` . (i18n "feed_title_on" | default "on") site.Title -}}
  9. {{- end -}}
  10. {{- end -}}
  11. {{ printf `<title type="html"><![CDATA[%s]]></title>` $title | safeHTML }}
  12. {{ with (or (.Param "subtitle") (.Param "tagline")) }}
  13. {{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}
  14. {{ end }}
  15. {{ $output_formats := .OutputFormats }}
  16. {{ range $output_formats -}}
  17. {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}}
  18. {{ with $output_formats.Get .Name }}
  19. {{ printf `<link href=%q rel=%q type=%q title=%q />` .Permalink $rel .MediaType.Type .Name | safeHTML }}
  20. {{- end -}}
  21. {{- end }}
  22. <updated>{{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
  23. {{ with site.Copyright }}
  24. {{- $copyright := replace . "{year}" now.Year -}} {{/* In case the site.copyright uses a special string "{year}" */}}
  25. {{- $copyright = replace $copyright "&copy;" "©" -}}
  26. <rights>{{ $copyright | plainify }}</rights>
  27. {{- end }}
  28. {{ with .Param "feed" }}
  29. {{/* For this to work, the $icon file should be present in the assets/ directory */}}
  30. {{- $icon := .icon | default "icon.svg" -}}
  31. {{- with resources.Get $icon -}}
  32. <icon>{{ (. | fingerprint).Permalink }}</icon>
  33. {{- end }}
  34. {{/* For this to work, the $logo file should be present in the assets/ directory */}}
  35. {{- $logo := .logo | default "logo.svg" -}}
  36. {{- with resources.Get $logo -}}
  37. <logo>{{ (. | fingerprint).Permalink }}</logo>
  38. {{- end }}
  39. {{ end }}
  40. {{ with site.Author.name -}}
  41. <author>
  42. <name>{{ . }}</name>
  43. {{ with site.Author.email }}
  44. <email>{{ . }}</email>
  45. {{ end -}}
  46. </author>
  47. {{- end }}
  48. {{ with site.Params.id }}
  49. <id>{{ . | plainify }}</id>
  50. {{ else }}
  51. <id>{{ .Permalink }}</id>
  52. {{ end }}
  53. {{- $limit := (cond (le site.Config.Services.RSS.Limit 0) 65536 site.Config.Services.RSS.Limit) }}
  54. {{- $feed_sections := site.Params.feedSections | default site.Params.mainSections -}}
  55. {{/* Range through only the pages with a Type in $feed_sections. */}}
  56. {{- $pages := where .RegularPages "Type" "in" $feed_sections -}}
  57. {{- if (eq .Kind "home") -}}
  58. {{- $pages = where site.RegularPages "Type" "in" $feed_sections -}}
  59. {{- end -}}
  60. {{/* Remove the pages that have the disable_feed parameter set to true. */}}
  61. {{- $pages = where $pages ".Params.disable_feed" "!=" true -}}
  62. {{- range first $limit $pages }}
  63. {{ $page := . }}
  64. <entry>
  65. {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
  66. <link href="{{ .Permalink }}?utm_source=atom_feed" rel="alternate" type="text/html" />
  67. {{- range .Translations }}
  68. {{- $link := printf "%s?utm_source=atom_feed" .Permalink | safeHTML }}
  69. {{- printf `<link href=%q rel="alternate" type="text/html" hreflang=%q />` $link .Lang | safeHTML }}
  70. {{- end }}
  71. {{ with .Params.id }}
  72. <id>{{ . | plainify }}</id>
  73. {{ else }}
  74. <id>{{ .Permalink }}</id>
  75. {{ end }}
  76. {{ with .Params.author -}}
  77. {{- range . -}} <!-- Assuming the author front-matter to be a list -->
  78. <author>
  79. <name>{{ . }}</name>
  80. </author>
  81. {{- end -}}
  82. {{- end }}
  83. <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
  84. <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
  85. {{ $description1 := .Description | default "" }}
  86. {{ $description := (cond (eq "" $description1) "" (printf "<blockquote>%s</blockquote>" ($description1 | markdownify))) }}
  87. {{ printf `<content type="html"><![CDATA[%s%s]]></content>` $description .Content | safeHTML }}
  88. </entry>
  89. {{ end }}
  90. </feed>