summaryrefslogtreecommitdiffstats
path: root/layouts/_default
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-06-05 22:11:41 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-06-05 22:11:41 +0200
commit99d814c09d76be0574f78670c7a7080fad95a8f1 (patch)
tree3f9cea75a01dfba6f2a4543502ea1f0b64549a5f /layouts/_default
parent5913da424459f523357b114a683059d3fc4bef68 (diff)
downloadgohugo-theme-ed-99d814c09d76be0574f78670c7a7080fad95a8f1.tar.gz
Rework site keywords
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/list.atom.xml17
1 files changed, 13 insertions, 4 deletions
diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml
index 5da5f25..eabd899 100644
--- a/layouts/_default/list.atom.xml
+++ b/layouts/_default/list.atom.xml
@@ -37,11 +37,20 @@
<id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id>{{- range $pages }}
<entry>
{{- $url := .Permalink | absURL }}{{ $uuid := sha1 (.Permalink | absURL) }}{{ $page := . }}
- <category term="{{ .Section }}" />{{ range (.GetTerms "tags") }}
- <category term="{{ .LinkTitle }}" />{{ end }}
+ {{ $section := .Section }}
+ <category term="{{ $section }}" />
+ {{ range (.GetTerms "tags") }}
+ {{ if not (eq .LinkTitle $section) }}
+ <category term="{{ .LinkTitle }}" x="y" />
+ {{ end }}
+ {{ end }}
<link rel="alternate" type="type/html" href="{{ $url }}?utm_source=atom_feed" />
- {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}{{ range first 5 (site.RegularPages.Related .) }}
- <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" />{{ end }}
+ {{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
+ {{/* See: https://discourse.gohugo.io/t/using-regularpages-related-gives-me-keywords-index-support-error/35657?u=egrep */}}
+ {{ $related := first 5 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
+ {{ range $related }}
+ <link href="{{ .Permalink }}?utm_source=atom_feed" rel="related" type="text/html" title="{{ .Title }}" />
+ {{ end }}
<published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</published>{{ if ne .Date .Lastmod }}
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}</updated>{{ end }}
<id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id>