aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2020-01-16 20:55:37 -0500
committerThedro Neely <thedroneely@gmail.com>2020-01-16 20:55:37 -0500
commit2dc991d62c72be9a3da368f5d9bc2c038c92b604 (patch)
tree6c9abaa061b247ef4365942fc3b8e1068d7fc908
parentd5c31c69fea79791f4566a8840a0a36afd8b8396 (diff)
downloadthedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.tar.gz
thedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.tar.bz2
thedroneely.com-2dc991d62c72be9a3da368f5d9bc2c038c92b604.zip
app/views/snippets/rss: Cleanup RSS
Hide pages with hidden attribute
-rw-r--r--app/views/partials/footer.php1
-rw-r--r--app/views/snippets/rss.php1
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/rss.xml31
3 files changed, 21 insertions, 12 deletions
diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php
index fb27861..5e2c648 100644
--- a/app/views/partials/footer.php
+++ b/app/views/partials/footer.php
@@ -12,7 +12,6 @@
<a class="underline" href="/resume">Resume</a> |
-
<a class="underline" rel="me" href="https://gitlab.com/tdro">Gitlab</a> |
<a class="underline" rel="me" href="https://twitter.com/thedroneely">Twitter</a> |
diff --git a/app/views/snippets/rss.php b/app/views/snippets/rss.php
index 3a72fc5..91d78cc 100644
--- a/app/views/snippets/rss.php
+++ b/app/views/snippets/rss.php
@@ -1,2 +1,3 @@
+<link href="/rss.xml" rel="alternate" type="application/rss+xml" title="All at Thedro Neely"/>
<link href="/posts/rss.xml" rel="alternate" type="application/rss+xml" title="Posts at Thedro Neely"/>
<link href="/projects/rss.xml" rel="alternate" type="application/rss+xml" title="Projects at Thedro Neely"/>
diff --git a/generators/hugo/themes/tdro/layouts/_default/rss.xml b/generators/hugo/themes/tdro/layouts/_default/rss.xml
index dfaf7f4..2bd93b9 100644
--- a/generators/hugo/themes/tdro/layouts/_default/rss.xml
+++ b/generators/hugo/themes/tdro/layouts/_default/rss.xml
@@ -1,4 +1,11 @@
-{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := $pctx.RegularPages -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
@@ -11,17 +18,19 @@
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
- {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
+ {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
- {{ range .Pages }}
- <item>
- <title>{{ .Title }}</title>
- <link>{{ .Permalink }}</link>
- <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
- {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
- <guid>{{ .Permalink }}</guid>
- <description>{{ .Content | replaceRE `<\?php(.*?\n?)*?\?>` "" | html }}</description>
- </item>
+ {{ range $pages }}
+ {{ if (ne .Params.hidden true) }}
+ <item>
+ <title>{{ .Title }}</title>
+ <link>{{ .Permalink }}</link>
+ <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+ {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
+ <guid>{{ .Permalink }}</guid>
+ <description>{{ .Content | replaceRE `<\?php(.*?\n?)*?\?>` "" | html }}</description>
+ </item>
+ {{ end }}
{{ end }}
</channel>
</rss>