This commit is contained in:
Loïc Guibert
2022-09-30 20:02:02 +01:00
commit 66dafc36c3
2561 changed files with 454489 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
{# Format specification: https://tools.ietf.org/html/rfc4287 #}
{% set collection = collection|default(page.collection) %}
{% set feed_updated = 0 %}
{% for page in collection %}
{%- set feed_updated = max(feed_updated, page.date) %}
{%- if collection.params.show_last_modified %}
{%- set feed_updated = max(feed_updated, page.modified) %}
{%- endif %}
{% endfor %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ collection.params.title }}</title>
<link href="{{ uri.rootUrl(true)~uri.uri() }}" rel="self" />
<subtitle>{{ collection.params.description }}</subtitle>
<updated>{{ feed_updated|date("Y-m-d\\TH:i:sP") }}</updated>
<author>
<name>{{ site.author.name }}</name>
</author>
<id>{{ page.url(true) }}</id>
{% for item in collection %}
{% set banner = item.media.images|first %}
<entry>
<title>{{ item.title|e }}</title>
<id>{{ item.url(true) }}</id>
{% if collection.params.show_last_modified %}
<updated>{{ item.modified|date("Y-m-d\\TH:i:sP") }}</updated>
{% else %}
<updated>{{ item.date|date("Y-m-d\\TH:i:sP") }}</updated>
{% endif %}
<published>{{ item.date|date("Y-m-d\\TH:i:sP") }}</published>
<link href="{{ item.url(true) }}"/>
{% for tag in item.taxonomy.tag %}
<category term="{{ tag|e }}" />
{% endfor %}
<content type="html">
<![CDATA[
{% if banner %}
{{ banner.cropZoom(1200,800).html|raw }}
{% endif %}
{{ item.content|safe_truncate_html(collection.params.length)|raw }}
]]>
</content>
</entry>
{% endfor %}
</feed>

View File

@@ -0,0 +1,43 @@
{# Format specification: https://www.jsonfeed.org/version/1/ #}
{% set collection = collection|default(page.collection) %}
{% set jsonfeed = {
"version" : "https://jsonfeed.org/version/1",
"title": collection.params.title,
"home_page_url": page.url(true),
"feed_url": uri.rootUrl(true)~uri.uri(),
"description": collection.params.description,
"author": {"name": site.author.name}
} %}
{% set itemList = [] %}
{% for item in collection %}
{%- set post = {
"title": item.title|e,
"date_published": item.date|date('Y-m-d\\TH:i:sP'),
"id": item.url(true),
"url": item.url(true),
"content_html": item.content|safe_truncate_html(collection.params.length)
} %}
{% set banner = item.media.images|first %}
{% if item.header.metadata.description %}
{%- set post = post|merge({"summary": item.header.metadata.description|e}) %}
{% endif %}
{% if collection.params.show_last_modified %}
{%- set post = post|merge({"date_modified": item.modified|date('Y-m-d\\TH:i:sP')}) %}
{% endif %}
{% if item.taxonomy.tag %}
{%- set post = post|merge({"tags": item.taxonomy.tag}) %}
{% endif %}
{% set image = item.media.images|first %}
{% if image %}
{%- set post = post|merge({"image": image.url(true)}) %}
{% endif %}
{%- set itemList = itemList|merge([post]) %}
{% endfor %}
{% set jsonfeed = jsonfeed|merge({"items": itemList}) %}
{{- jsonfeed|json_encode|raw }}

View File

@@ -0,0 +1,40 @@
{# Format specification: https://www.rssboard.org/rss-specification #}
{% set collection = collection|default(page.collection) %}
{% set lastBuildDate = 0 %}
{% for page in collection %}
{%- set lastBuildDate = max(lastBuildDate, page.date) %}
{%- if collection.params.show_last_modified %}
{%- set lastBuildDate = max(feed_updated, page.modified) %}
{%- endif %}
{% endfor %}
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>{{ collection.params.title }}</title>
<link>{{ page.url(true) }}</link>
<atom:link href="{{ uri.rootUrl(true)~uri.uri() }}" rel="self" type="application/rss+xml"/>
<description>{{ collection.params.description }}</description>
<language>{{ grav.language.getLanguage|default(config.system.language.default_lang)|default('en') }}</language>
<lastBuildDate>{{ lastBuildDate|date('D, d M Y H:i:s O') }}</lastBuildDate>
{% for item in collection %}
{% set banner = item.media.images|first %}
<item>
<title>{{ item.title|e }}</title>
<link>{{ item.url(true) }}</link>
<guid>{{ item.url(true) }}</guid>
<pubDate>{{ item.date|date('D, d M Y H:i:s O') }}</pubDate>
<description>
<![CDATA[
{% if banner %}
{{ banner.cropZoom(1200,800).html|absolute_url|raw }}
{% endif %}
{{ item.content|safe_truncate_html(collection.params.length)|raw }}
]]>
</description>
{% for tag in item.taxonomy.tag %}
<category>{{ tag|e }}</category>
{% endfor %}
</item>
{% endfor %}
</channel>
</rss>