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.

108 lines
5.6 KiB

  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. {{/* rel=related: See https://validator.w3.org/feed/docs/atom.html#link */}}
  72. {{- range first 5 (site.RegularPages.Related .) }}
  73. <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" />
  74. {{- end }}
  75. {{ with .Params.id }}
  76. <id>{{ . | plainify }}</id>
  77. {{ else }}
  78. <id>{{ .Permalink }}</id>
  79. {{ end }}
  80. {{ with .Params.author -}}
  81. {{- range . -}} <!-- Assuming the author front-matter to be a list -->
  82. <author>
  83. <name>{{ . }}</name>
  84. </author>
  85. {{- end -}}
  86. {{- end }}
  87. <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
  88. <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
  89. {{ $description1 := .Description | default "" }}
  90. {{ $description := (cond (eq "" $description1) "" (printf "<blockquote>%s</blockquote>" ($description1 | markdownify))) }}
  91. {{ printf `<content type="html"><![CDATA[%s%s]]></content>` $description .Content | safeHTML }}
  92. {{ with site.Taxonomies }}
  93. {{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
  94. {{ with $page.Param $taxo }}
  95. {{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
  96. {{ with site.GetPage (printf "/%s" $taxo) }}
  97. {{ $taxonomy_page := . }}
  98. {{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
  99. <category scheme="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}" term="{{ (. | urlize) }}" label="{{ . }}" />
  100. {{ end }}
  101. {{ end }}
  102. {{ end }}
  103. {{ end }}
  104. {{ end }}
  105. </entry>
  106. {{ end }}
  107. </feed>