1
Fork 0

Reuse page data shortcode for JSON data

This commit is contained in:
Jake Howard 2018-01-07 15:14:45 +00:00
parent 13e3f5291f
commit 85e2a031b6
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 9 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{
{{ range $i, $e := .Data.Pages.ByTitle }}
{{ if $i }}, {{ end }}
{{ partial "page_data.json" . }}
"{{ .RelPermalink }}": {{ partial "page_data.json" . }}
{{ end }}
}

View file

@ -1,12 +1 @@
{
"id": "{{ .UniqueID }}",
"title": "{{ .Title }}",
"date_published": "{{ .Date }}",
"image": "{{ absURL .Params.image }}",
"url": "{{ .Permalink }}",
"content_html": {{ jsonify .Content }},
"content_text": {{ jsonify .RawContent }},
"summary": {{ jsonify .Summary }},
"banner_image": "{{ absURL .Params.image }}",
"tags": {{ jsonify .Params.tags }}
}
{{ partial "page_data.json" . }}

View file

@ -1,12 +1,16 @@
"{{ .RelPermalink }}": {
{
"id": "{{ .UniqueID }}",
"title": "{{ lower .Title }}",
"title": "{{ .Title }}",
"image": "{{ absURL .Params.image }}",
"date": "{{ .Date }}",
"url": "{{ .Permalink }}",
"link": "{{ .RelPermalink }}",
"link_title": "{{ .LinkTitle }}",
"content_html": {{ jsonify (.Content | plainify | chomp | htmlUnescape) }},
"content_text": {{ jsonify .RawContent }},
"summary": {{ jsonify (.Summary | plainify | chomp | htmlUnescape) }},
"words": {{ .FuzzyWordCount }},
"reading_time": {{ .ReadingTime }},
"parent": "{{ if .Parent }}{{ lower .Parent.Title }}{{ end }}",
"parent": "{{ if .Parent }}{{ .Parent.Title }}{{ end }}",
"tags": {{ jsonify .Params.tags }}
}