blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit 3eee0e10890872dfd9efcbc6cf498742e3b5fd08
parent 820b015019d881aaf91b6e951b864fc3afa5b68d
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Tue, 14 Apr 2020 07:05:10 -0500

Move rss.xml to _default so it gets picked up by section feeds as well

Diffstat:
Alayouts/_default/rss.xml | 24++++++++++++++++++++++++
Dlayouts/rss.xml | 20--------------------
2 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
@@ -0,0 +1,24 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <title>{{ .Site.Title }}</title>
+  <link href="{{ .Permalink }}"/>
+  <link href="{{ .Permalink }}index.xml" rel="self"/>
+  <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}</updated>
+  <author><name>{{ .Site.Author.name }}</name></author>
+  <id>{{ .Permalink }}</id>
+  {{ $pages := (first 20 .Data.Pages) }}
+  {{ if .IsHome }}
+  {{ $pages = (first 20 (where .Site.RegularPages "Section" "!=" "")) }}
+  {{ end }}
+  {{ range $pages }}
+  <entry>
+    <id>{{ .Permalink }}</id>
+    {{ `<title type="html"><![CDATA[` | safeHTML -}}
+    {{- if .Title }}{{ .Title }}{{ else -}}
+    {{- truncate .Site.Params.summaryLength "…" (plainify .Content) }}{{ end -}}
+    {{- `]]></title>` | safeHTML -}}
+    <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}</updated>
+    {{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}{{ partial "hyperskip_feed.html" . }}]]></content>
+    <link href="{{ .Permalink }}"/>
+  </entry>
+  {{ end }}
+</feed>
diff --git a/layouts/rss.xml b/layouts/rss.xml
@@ -1,20 +0,0 @@
-<feed xmlns="http://www.w3.org/2005/Atom">
-  <title>{{ .Site.Title }}</title>
-  <link href="{{ .Permalink }}"/>
-  <link href="{{ .Permalink }}index.xml" rel="self"/>
-  <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}</updated>
-  <author><name>{{ .Site.Author.name }}</name></author>
-  <id>{{ .Permalink }}</id>
-  {{ range (first 20 (where .Site.RegularPages "Section" "!=" "")) }}
-  <entry>
-    <id>{{ .Permalink }}</id>
-    {{ `<title type="html"><![CDATA[` | safeHTML -}}
-    {{- if .Title }}{{ .Title }}{{ else -}}
-    {{- truncate .Site.Params.summaryLength "…" (plainify .Content) }}{{ end -}}
-    {{- `]]></title>` | safeHTML -}}
-    <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}</updated>
-    {{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}{{ partial "hyperskip_feed.html" . }}]]></content>
-    <link href="{{ .Permalink }}"/>
-  </entry>
-  {{ end }}
-</feed>