portal/api.json

44 lines
1.9 KiB
JSON
Raw Normal View History

2019-11-25 20:04:00 +01:00
---
layout: null
---
{
"website_title": "{{ site.title | xml_escape }}",
"website_url": "{{ "/" | absolute_url }}",
"posts": [
{% for post in site.posts %}
{
"title": {{ post.title | jsonify }},
"content_text": {{ post.content | strip_html | strip_newlines | jsonify }},
"content_html": {{ post.content | strip_newlines | jsonify }},
"url": "{{ post.url | absolute_url }}",
{% if post.image.size > 0 %}
"image": {{ post.image | jsonify }},{% endif %}
{% if post.categories.size > 0 %}
"categories": {{ post.categories | jsonify }},{% endif %}
{% if post.tags.size > 0 %}
"tags": {{ post.tags | jsonify }},{% endif %}
"date_published": "{{ post.date | date_to_xmlschema }}",
"date_modified": "{{ post.date | date_to_xmlschema }}",
{% if post.author %}
"author": {% if post.author.name %} "{{ post.author.name }}" {% else %} "{{ post.author }}" {% endif %}
{% else %}
"author": {% if site.author.name %} "{{ site.author.name }}" {% else %} "{{ site.author }}" {% endif %}
{% endif %}
}{% if forloop.last == false %},{% endif %}
{% endfor %}
],
"pages": [
{% for page in site.pages %}
{
"title": {{ page.title | jsonify }},
"content_text": {{ page.content | strip_html | strip_newlines | jsonify }},
"content_html": {{ page.content | strip_newlines | jsonify }},
"url": "{{ page.url | absolute_url }}",
"date_published": "{{ page.date | date_to_xmlschema }}",
"date_modified": "{{ page.date | date_to_xmlschema }}"
}{% if forloop.last == false %},{% endif %}
{% endfor %}
]
}