Merge pull request #35 from heitorPB/autoconfigure-feed-type

Automatically set link to RSS or ATOM feed
This commit is contained in:
Paweł Romanowski 2023-06-23 11:49:20 +02:00 committed by GitHub
commit 6e91e642f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -5,6 +5,12 @@ title = "Zola Terminimal theme"
# Sass compilation is required
compile_sass = true
# The theme supports feeds (RSS and ATOM)
generate_feed = true
# Use `rss.xml` for RSS feeds and `atom.xml` for ATOM.
feed_filename = "atom.xml"
# Optional: enable tags
taxonomies = [
{name = "tags"}

View file

@ -12,7 +12,12 @@
{{ head_macros::head(config=config) }}
{%- if config.generate_feed %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
{%- if "rss" in config.feed_filename %}
{% set feed_type = 'rss+xml' %}
{%- else %}
{% set feed_type = 'atom+xml' %}
{% endif -%}
<link rel="alternate" type="application/{{ feed_type }}" title="RSS" href="{{ get_url(path=config.feed_filename) | safe }}">
{% endif -%}
{%- if config.extra.favicon %}