From 32baf7cad5cae3af81dc9512eaab7c27b077b8c1 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Fri, 25 Oct 2019 20:36:24 -0400 Subject: [PATCH] Custom Atom feed and limit to 20 with full content --- layouts/index.json | 7 ++++--- layouts/index.xml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 layouts/index.xml diff --git a/layouts/index.json b/layouts/index.json index 025c9272..a0141367 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -7,20 +7,21 @@ "feed_url": "{{ .Permalink}}", "items": [ - {{ range $i, $e := first 40 .Site.RegularPages }} + {{ range $i, $e := first 20 .Site.RegularPages }} {{ if $i }}, {{ end }} { "id": "{{ .Permalink }}", "title": "{{ .Title }}", - {{ if .Params.image }} {{ $src := .Page.Resources.GetMatch (.Params.image) }} + {{ if .Params.image }} + {{ $src := .Page.Resources.GetMatch (.Params.image) }} {{ $image := $src.Fit $imageSize }} "image": "{{ $image.RelPermalink }}", {{ end }} {{ if .Params.categories }} "categories": ["{{ delimit .Params.categories "," }}"], {{ end }} - "content_text": {{ .Summary | jsonify }}, + "content_html": {{ .Content | jsonify }}, "url": "{{ .Permalink }}", "date_published": "{{ .Date }}" } diff --git a/layouts/index.xml b/layouts/index.xml new file mode 100644 index 00000000..6cdf3b55 --- /dev/null +++ b/layouts/index.xml @@ -0,0 +1,33 @@ +{{ printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + + {{ .Permalink }}" + Hugo + + {{ with .Site.Author.email }} + + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}} + + {{end}} + + {{ with .Site.Copyright }} + {{.}} + {{end}} + + {{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ end }} + + {{ range first 20 .Site.RegularPages }} + + {{ .Title }} + + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + +