From fa39098ed994bffd3b3560199a3d65d774e48d15 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 28 Sep 2024 09:58:22 +0200 Subject: Removed custom RSS template --- CHANGELOG.md | 4 +++ exampleSite/config/_default/config.yaml | 27 ++++----------- exampleSite/hugo.toml | 4 +++ layouts/_default/list.feed.xml | 60 --------------------------------- layouts/partials/alternate-outputs.html | 6 ---- layouts/partials/head.html | 8 +++-- 6 files changed, 21 insertions(+), 88 deletions(-) create mode 100644 exampleSite/hugo.toml delete mode 100644 layouts/_default/list.feed.xml delete mode 100644 layouts/partials/alternate-outputs.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1d621..8d8c22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed `GetLanguageDirection` function as it is no longer needed. - Drop support of AnonymizeIp configuration parameter for Google Analytics as it is no longer relevant in Google Analytics >= v4. +- Removed custom RSS template (`layouts/_default/list.feed.xml`), relying + entirely on Hugo's built-in rendering. +- Removed `layouts/partials/alternate-outputs.html` partial. Alternate outputs + (e.g., RSS, Atom feeds, etc.) are now handled in `layouts/partials/head.html`. ## [v0.8.0](https://github.com/sergeyklay/gohugo-theme-ed/compare/v0.7.0...v0.8.0) diff --git a/exampleSite/config/_default/config.yaml b/exampleSite/config/_default/config.yaml index dca03da..7997d9f 100644 --- a/exampleSite/config/_default/config.yaml +++ b/exampleSite/config/_default/config.yaml @@ -15,10 +15,6 @@ enableRobotsTXT: true # resolve, it will be logged with this log level. refLinksErrorLevel: WARNING -# Kick out RSS, we'll use Atom and FEED bellow. -disableKinds: - - RSS - # We have just the default tags taxonomy, and remove the categories # taxonomy for site as not used. taxonomies: @@ -32,11 +28,12 @@ minify: keepQuotes: true outputs: - home: [HTML, Atom, FEED, JSONFEED, JSON, MANIFEST, humanstxt] - section: [HTML, Atom, FEED, JSONFEED] + home: [HTML, RSS, MANIFEST, Atom, JSONFEED, JSON, humanstxt] page: [HTML] - taxonomy: [HTML] - term: [HTML] + rss: [RSS] + section: [HTML, RSS, Atom, JSONFEED] + taxonomy: [HTML, RSS] + term: [HTML, RSS] outputFormats: # For more see: https://validator.w3.org/feed/docs/atom.html#whatIsAtom @@ -58,16 +55,6 @@ outputFormats: noUgly: true permalinkable: false - FEED: - name: Feed - mediaType: text/xml - baseName: feeds/feed.rss - rel: alternate - isPlainText: false - isHTML: false - noUgly: true - permalinkable: false - # For more see: https://www.jsonfeed.org/ JSONFEED: name: JsonFeed @@ -91,7 +78,7 @@ outputFormats: isPlainText: true isHTML: false noUgly: false - notAlternative: true + notAlternative: false # For more see: https://gohugo.io/templates/output-formats/ humanstxt: @@ -117,7 +104,7 @@ mediaTypes: # Sitemap config sitemap: - changefreq: weekly + changefreq: monthly filename: sitemap.xml priority: 0.5 diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml new file mode 100644 index 0000000..a666a90 --- /dev/null +++ b/exampleSite/hugo.toml @@ -0,0 +1,4 @@ +[outputFormats] + [outputFormats.rss] + baseName = 'rss' + mediaType = 'application/rss+xml' diff --git a/layouts/_default/list.feed.xml b/layouts/_default/list.feed.xml deleted file mode 100644 index c4be170..0000000 --- a/layouts/_default/list.feed.xml +++ /dev/null @@ -1,60 +0,0 @@ -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} - -{{- $pages := slice -}} -{{- if $.IsHome -}} - {{- $mainSections := site.Params.mainSections | default (slice "posts") }} - {{- $pages = where $pctx.RegularPages.ByDate.Reverse "Type" "in" $mainSections -}} -{{- else if $.IsSection -}} - {{- $pages = $pctx.RegularPages.ByDate.Reverse -}} -{{- else -}} - {{- $pages = $pctx.Pages -}} -{{- end -}} - -{{- $limit := site.Params.feedSize | default 25 -}} -{{- $pages = $pages | first $limit -}} - -{{- $siteLastMod := partial "site-last-mod.html" . -}} -{{- $siteAuthor := partial "site-author.html" . -}} - -{{- printf "" | safeHTML }} - - - {{ partial "title.html" . }} - {{ .Permalink }} - {{ partial "description.html" . }} - Hugo {{ hugo.Version }} - {{ site.Language.LanguageCode }}{{ with site.Params.Copyright -}} - {{ $copyright := replace . "{year}" now.Year }}{{ $copyright = replace $copyright "©" "©" }} - {{ $copyright | plainify }}{{ end }} - {{ $siteLastMod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{- $output_formats := .OutputFormats }} - {{- range $output_formats -}} - {{- $rel := (or (and (eq "feed" (.Name | lower)) "self") "alternate") -}} - {{- with $output_formats.Get .Name }} - {{ printf `` .RelPermalink $rel .MediaType.Type .Name | safeHTML }} - {{- end -}} - {{- end }} - {{- range $pages }} - - {{ .Title }} - {{ .Permalink | absURL }}?utm_source=rss_feed - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with $siteAuthor.email }}{{ . }}{{ with $siteAuthor.name }} ({{ . }}){{ end }}{{ end }} - {{ .Section }}{{ range (.GetTerms "tags") }} - {{ .LinkTitle }}{{ end }} - {{ md5 .Permalink }} - {{ .Summary | transform.XMLEscape | safeHTML }} - - {{ end }} - - diff --git a/layouts/partials/alternate-outputs.html b/layouts/partials/alternate-outputs.html deleted file mode 100644 index 52bdd0d..0000000 --- a/layouts/partials/alternate-outputs.html +++ /dev/null @@ -1,6 +0,0 @@ -{{- range .AlternativeOutputFormats }} - -{{- end }} - - - diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5bf6e09..94684a2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -18,8 +18,12 @@ - {{- /* Feed, sitemap and manifest */}} - {{ partial "alternate-outputs.html" . }} + {{- range .AlternativeOutputFormats }} + + {{- end }} + + + {{- range .AllTranslations -}} -- cgit v1.2.3