mirror of
https://github.com/danbee/danbarber.me.hugo.git
synced 2025-03-04 08:59:18 +00:00
Custom Atom feed and limit to 20 with full content
This commit is contained in:
parent
267bed50a7
commit
890f9c3be5
@ -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 }}"
|
||||
}
|
||||
|
||||
33
layouts/index.xml
Normal file
33
layouts/index.xml
Normal file
@ -0,0 +1,33 @@
|
||||
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link href="{{ .Permalink }}" />
|
||||
<id>{{ .Permalink }}"</id>
|
||||
<generator uri="https://gohugo.io">Hugo</generator>
|
||||
|
||||
{{ with .Site.Author.email }}
|
||||
<author>
|
||||
<name>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</name>
|
||||
</author>
|
||||
{{end}}
|
||||
|
||||
{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>
|
||||
{{end}}
|
||||
|
||||
{{ if not .Date.IsZero }}
|
||||
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
|
||||
{{ end }}
|
||||
|
||||
{{ range first 20 .Site.RegularPages }}
|
||||
<entry>
|
||||
<title>{{ .Title }}</title>
|
||||
<link href="{{ .Permalink }}" />
|
||||
<updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</updated>
|
||||
<id>{{ .Permalink }}</id>
|
||||
<content type="html">{{ .Content | html }}</content>
|
||||
</entry>
|
||||
{{ end }}
|
||||
|
||||
</feed>
|
||||
Loading…
Reference in New Issue
Block a user