Skip to content

Commit

Permalink
Merge pull request #35 from heitorPB/autoconfigure-feed-type
Browse files Browse the repository at this point in the history
Automatically set link to RSS or ATOM feed
  • Loading branch information
pawroman committed Jun 23, 2023
2 parents a1ed252 + a5e119e commit 6e91e64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
7 changes: 6 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit 6e91e64

Please sign in to comment.