meta: Add Atom feed
This commit is contained in:
parent
67bb8ddac9
commit
321309971c
21 changed files with 146 additions and 86 deletions
60
layouts/list.atom.atom
Normal file
60
layouts/list.atom.atom
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{{- $authorEmail := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .email }}
|
||||
{{- $authorEmail = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $authorName := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .name }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $pctx := . }}
|
||||
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
|
||||
{{- $pages := slice }}
|
||||
{{- if or $.IsHome $.IsSection }}
|
||||
{{- $pages = $pctx.RegularPages }}
|
||||
{{- else }}
|
||||
{{- $pages = $pctx.Pages }}
|
||||
{{- end }}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
||||
{{- if ge $limit 1 }}
|
||||
{{- $pages = $pages | first $limit }}
|
||||
{{- end }}
|
||||
<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 }}index.atom" rel="self"/>
|
||||
<link href="{{ .Permalink }}"/>
|
||||
<updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
||||
<id>{{ .Permalink }}</id>
|
||||
<author>
|
||||
<name>{{ with $authorName }}{{ . }}{{ end }}</name>
|
||||
<email>{{ with $authorEmail }}{{ . }}{{ end }}</email>
|
||||
</author>
|
||||
<generator>Hugo</generator>
|
||||
{{- range $pages }}
|
||||
<entry>
|
||||
<title type="html">{{ .Title }}</title>
|
||||
<link href="{{ .Permalink }}"/>
|
||||
<id>{{ .Permalink }}</id>
|
||||
<author>
|
||||
<name>{{ with $authorName }}{{ . }}{{ end }}</name>
|
||||
<email>{{ with $authorEmail }}{{ . }}{{ end }}</email>
|
||||
</author>
|
||||
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
|
||||
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
||||
<content type="html">
|
||||
{{ .Content | transform.XMLEscape | safeHTML }}
|
||||
</content>
|
||||
</entry>
|
||||
{{- end }}
|
||||
</feed>
|
||||
Loading…
Add table
Add a link
Reference in a new issue