Automatically set link to RSS or ATOM feed

Set the <link > type to either `application/rss+xml` or
`application/atom+xml` according to the `feed_filename` from
`config.toml`.
This commit is contained in:
Heitor Pascoal de Bittencourt 2023-05-04 12:57:57 -03:00
parent 9347dda144
commit 491d7d061e
No known key found for this signature in database
GPG key ID: 2DD9C1566E2774A2

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 %}