Skip to content

Adds atom template with logic for multiple RSS feeds #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/events/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
title = "Events"
template = "events.html"
page_template = "event-page.html"
generate_feeds = true
+++
57 changes: 57 additions & 0 deletions templates/atom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{# built from https://github.com/getzola/zola/blob/master/components/templates/src/builtins/rss.xml / MIT #}<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
<title>{{ config.title }}
{%- if term %} - {{ term.name }}
{%- elif section.title %} - {{ section.title }}
{%- endif -%}
</title>
{%- if config.description %}
<subtitle>{{ config.description }}</subtitle>
{%- endif %}
<link rel="self" type="application/atom+xml" href="{{ feed_url | safe }}"/>
<link rel="alternate" type="text/html" href="
{%- if section -%}
{{ section.permalink | escape_xml | safe }}{%- set section_id = section.components[0] -%}
{%- else -%}
{{ config.base_url | escape_xml | safe }}
{%- endif -%}
"/>

<generator uri="https://www.getzola.org/">Zola</generator>
{% if last_updated is defined %}<updated>{{ last_updated | date(format="%+") }}</updated>{% endif %}
<id>{{ feed_url | safe }}</id>
{%- for page in pages %}

{%- if (page.components[0] == "blog") or (section_id and section_id == page.components[0]) -%}
<entry xml:lang="{{ page.lang }}">
<title>{{ page.title }}</title>
<published>{{ page.date | date(format="%+") }}</published>
<updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
{% for author in page.authors %}
<author>
<name>
{{ author }}
</name>
</author>
{% else %}
<author>
<name>
{%- if config.author -%}
{{ config.author }}
{%- else -%}
Unknown
{%- endif -%}
</name>
</author>
{% endfor %}
<link rel="alternate" type="text/html" href="{{ page.permalink | safe }}"/>
<id>{{ page.permalink | safe }}</id>
{% if page.summary %}
<summary type="html">{{ page.summary }}</summary>
{% else %}
<content type="html" xml:base="{{ page.permalink | escape_xml | safe }}">{{ page.content }}</content>
{% endif %}
</entry>
{%- endif -%}
{%- endfor %}
</feed>