From d9ece829109422c35ff5e2c1091f20d2af20bc95 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 21 Oct 2020 11:23:00 +0800 Subject: [PATCH] Move the web feeds as its own theme component This will make my theme creation process smoother now that I don't have to migrate per theme. I can focus more polishing the aesthetics of the theme. Though, this does add an extra step for the users but that can be mitigated by writing good documentation (right?). --- layouts/_default/list.atom | 56 ------------------------------- layouts/_default/list.json | 31 ------------------ layouts/_default/list.rss | 67 -------------------------------------- 3 files changed, 154 deletions(-) delete mode 100644 layouts/_default/list.atom delete mode 100644 layouts/_default/list.json delete mode 100644 layouts/_default/list.rss diff --git a/layouts/_default/list.atom b/layouts/_default/list.atom deleted file mode 100644 index 60eb6bd..0000000 --- a/layouts/_default/list.atom +++ /dev/null @@ -1,56 +0,0 @@ -{{- /* This template was based from the Atom syndication format at IETF RFC #4287 (https://tools.ietf.org/html/rfc4287). */ -}} -{{ printf "" | safeHTML }} - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - - {{- range .AlternativeOutputFormats }} - {{- printf "" .Rel .MediaType .Permalink | safeHTML }} - {{- end }} - {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} {{ with .Site.Author.name }}{{ . }}{{ end }}{{ end }} - Hugo - {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} - {{ "" | absLangURL }} - - {{- /* ICON, AHOY! */ -}} - {{ "icon.png" | absURL }} - - {{ with .Site.Author }} - - {{ .name }} - {{ with .email }}{{ . }}{{ end }} - - {{ end }} - - {{- /* Generate each valid regular pages (with as an individual entry in the feed. */ -}} - {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} - {{ $pages := .Pages }} - {{ if .IsHome }} - {{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} - {{ end }} - {{ range first $limit (where $pages "Params.hidden" "!=" true) }} - - {{ .Permalink }} - {{ .Title }} - - - {{- range .Params.author }} - - {{ .name }}{{ with .email }} - {{ . }}{{ end }} - - {{- end }} - - {{- range .Params.tags }} - - {{- end }} - {{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} - {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }} - - {{ with .Params.copyright }} - {{ . | safeHTML }} - {{ end }} - - {{ .Content | html }} - - {{ end }} - diff --git a/layouts/_default/list.json b/layouts/_default/list.json deleted file mode 100644 index 693ed21..0000000 --- a/layouts/_default/list.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "https://jsonfeed.org/version/1", - "title": "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}", - "home_page_url": "{{ "" | absLangURL }}", - "feed_url": "{{ with .OutputFormats.Get "json" }}{{ .Permalink }}{{ end }}", - "description": "Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}", - {{- /* ICON, AHOY! */ -}} - "favicon": "{{ "icon.png" | absURL }}", - "icon": "{{ "icon.png" | absURL }}", - - {{- with .Site.Author }} - "author": { - "name": "{{ .name }}" - {{- with .email }}, - "url": "mailto:{{ . }}" - {{ end }} - }, - {{- end }} - "items": - {{- $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 -}} - - {{ $pages := .Pages }} - {{ if .IsHome }} - {{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} - {{ end }} - {{- $.Scratch.Add "index" slice -}} - {{ range first $limit (where $pages "Params.hidden" "!=" true) }} - {{- $.Scratch.Add "index" (dict "id" .Permalink "url" .Permalink "title" .Title "summary" (.Summary | safeHTML) "content_html" (.Content | safeHTML) "tags" .Params.tags "date_published" (.Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML) "date_modified" ( .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML ) ) -}} - {{- end -}} - {{- $.Scratch.Get "index" | jsonify -}} -} diff --git a/layouts/_default/list.rss b/layouts/_default/list.rss deleted file mode 100644 index 71b7855..0000000 --- a/layouts/_default/list.rss +++ /dev/null @@ -1,67 +0,0 @@ -{{- /* -The reference used to create this template is at https://cyber.harvard.edu/rss/rss.html. -The template does miss out on certain things which I put it on a list for those who are interested: - * Since there's no standard for multiple authors (with ) in the element, I decided it would be best to leave it out for now. - * The name was left out for certain elements that requires an email address (like , , or in the . - * is a permalink to the HTML post. - * No . - * contains the whole post; if you want to change it to and make a summarized version, refer to https://www.rssboard.org/rss-profile and change the description tag with `.Summary | safeHTML`. -*/ -}} -{{ printf "" | safeHTML }} - - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io - {{- /* ICON, AHOY! */ -}} - {{ "icon.png" | absURL }} - - {{ with .Site.LanguageCode }} - {{.}} - {{end}} - - {{ with .Site.Author.email }} - {{.}} - {{.}} - {{end}} - - {{ with .Site.Copyright }}{{ . }}{{ else }}© {{ now.Year }} to the author(s) behind {{ .Site.Title }}{{ end }} - - {{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ end }} - - https://cyber.harvard.edu/rss/rss.html - - {{ with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{ end }} - - {{- /* Point the alternative output formats. */ -}} - {{ range .AlternativeOutputFormats }} - {{ printf "" .Permalink .Rel .MediaType | safeHTML }} - {{ end }} - - {{- /* Iterate each valid regular page. */ -}} - {{ $limit := cond (gt .Site.Params.feedLimit 0) .Site.Params.feedLimit 10 }} - {{ $pages := .Pages }} - {{ if .IsHome }} - {{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} - {{ end }} - {{ range first $limit (where $pages "Params.hidden" "!=" true) }} - - {{ .Title }} - {{ .Permalink }} - - {{ range .Params.tags }} - {{ . }} - {{ end }} - - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ .Permalink }} - {{ .Content | html }} - - {{ end }} - -