Implement new layout dir structure.
This commit is contained in:
parent
c94e3a7022
commit
83530eb11a
1 changed files with 1 additions and 1 deletions
59
layouts/list.json.json
Normal file
59
layouts/list.json.json
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{{- $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 }}
|
||||
{{ $length := (len $pages) -}}
|
||||
{
|
||||
"version": "https://jsonfeed.org/version/1.1",
|
||||
"title": "{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ site.Title }}{{ end }}",
|
||||
"description": "{{ i18n "string_recent_content" }} {{ if ne .Title site.Title }}{{ with .Title }}{{ i18n "string_in" }} {{ . }} {{ end }}{{ end }}{{ i18n "string_on" }} {{ site.Title }}",
|
||||
"home_page_url": "{{ site.BaseURL }}",
|
||||
{{ with .OutputFormats.Get "JSON" -}}
|
||||
"feed_url": "{{ .Permalink }}",
|
||||
{{ end -}}
|
||||
{{ with site.Language.LanguageCode -}}
|
||||
"language": "{{ . }}",
|
||||
{{ end -}}
|
||||
{{ with $.Param "icon" -}}
|
||||
"icon": "{{ . | absURL }}",
|
||||
{{ end -}}
|
||||
{{ with $.Param "favicon" -}}
|
||||
"favicon": "{{ . | absURL }}",
|
||||
{{ end -}}
|
||||
{{ with site.Params.author.name -}}
|
||||
"authors": [
|
||||
{
|
||||
"name": "{{ . }}"{{ with site.Params.author.url }},
|
||||
"url": "{{ . }}"{{ end }}{{ with site.Params.author.avatar }},
|
||||
"avatar": "{{ . | absURL }}"{{ end }}
|
||||
}
|
||||
],
|
||||
{{ end -}}
|
||||
"items": [
|
||||
{{ range $index, $element := $pages -}}
|
||||
{
|
||||
"title": {{ .Title | jsonify }},
|
||||
"date_published": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
|
||||
"date_modified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}",
|
||||
"id": "{{ .Permalink }}",
|
||||
"url": "{{ .Permalink }}",
|
||||
{{ with .Params.author -}}
|
||||
"authors": [
|
||||
{
|
||||
"name": "{{ . }}"
|
||||
}
|
||||
],
|
||||
{{ end -}}
|
||||
"content_html": {{ .Content | jsonify }}
|
||||
}{{ if ne (add $index 1) $length }},{{ end }}
|
||||
{{ end -}}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue