diff --git a/templates/atom.xml b/templates/atom.xml index acdd6b2e3..fce3af4cd 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -1,3 +1,4 @@ +{% import "macros/atom.html" as atom %} {{ config.title }} @@ -19,25 +20,14 @@ <generator uri="https://www.getzola.org/">Zola</generator> <updated>{{ last_updated | date(format="%+") }}</updated> <id>{{ feed_url | safe }}</id> + {% set pageslen = pages | length %} + {% if pageslen > 15 %} + {% for i in range(end=15) %} + {{ atom::entry(page=pages[i]) }} + {% endfor %} + {% else %} {%- for page in pages %} - <entry xml:lang="{{ page.lang }}"> - <title>{{ page.title }} - {{ page.date | date(format="%+") }} - {{ page.updated | default(value=page.date) | date(format="%+") }} - - - {%- if page.authors -%} - {{ page.authors[0] }} - {%- elif config.author -%} - {{ config.author }} - {%- else -%} - Unknown - {%- endif -%} - - - - {{ page.permalink | safe }} - {{ page.content }} - + {{ atom::entry(page=page) }} {%- endfor %} + {% endif %} diff --git a/templates/macros/atom.html b/templates/macros/atom.html new file mode 100644 index 000000000..5deb94d8f --- /dev/null +++ b/templates/macros/atom.html @@ -0,0 +1,21 @@ +{% macro entry(page) %} + + {{ page.title }} + {{ page.date | date(format="%+") }} + {{ page.updated | default(value=page.date) | date(format="%+") }} + + + {%- if page.authors -%} + {{ page.authors[0] }} + {%- elif config.author -%} + {{ config.author }} + {%- else -%} + Unknown + {%- endif -%} + + + + {{ page.permalink | safe }} + {{ page.content }} + +{% endmacro %}