diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs
index baca868e2b..33c40cc2e0 100644
--- a/components/site/tests/site.rs
+++ b/components/site/tests/site.rs
@@ -685,6 +685,12 @@ fn can_build_feeds() {
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Foo Doe"));
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Bar Doe"));
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Baz Doe"));
+
+ // Test feeds with extended block
+ assert!(file_contains!(public, "atom.xml", "Foo tag"));
+ assert!(file_contains!(public, "rss.xml", "Bar tag"));
}
#[test]
diff --git a/components/templates/src/builtins/atom.xml b/components/templates/src/builtins/atom.xml
index 1533175991..6322580b67 100644
--- a/components/templates/src/builtins/atom.xml
+++ b/components/templates/src/builtins/atom.xml
@@ -48,6 +48,9 @@
{% else %}
{{ page.content }}
{% endif %}
+
+ {%- block atom_entry_extra %}
+ {% endblock atom_entry_extra -%}
{%- endfor %}
diff --git a/components/templates/src/builtins/rss.xml b/components/templates/src/builtins/rss.xml
index a684a48af9..15a354a216 100644
--- a/components/templates/src/builtins/rss.xml
+++ b/components/templates/src/builtins/rss.xml
@@ -34,6 +34,9 @@
{{ page.permalink | escape_xml | safe }}
{{ page.permalink | escape_xml | safe }}
{% if page.summary %}{{ page.summary }}{% else %}{{ page.content }}{% endif %}
+
+ {%- block rss_item_extra %}
+ {% endblock rss_item_extra -%}
{%- endfor %}
diff --git a/docs/content/documentation/templates/feeds/index.md b/docs/content/documentation/templates/feeds/index.md
index e133192317..a0a5306977 100644
--- a/docs/content/documentation/templates/feeds/index.md
+++ b/docs/content/documentation/templates/feeds/index.md
@@ -15,6 +15,13 @@ for `atom.xml` (in the preferred Atom 1.0 format), and `rss.xml` (in the RSS
2.0 format). If you choose a different filename (e.g. `feed.xml`), you will
need to provide a template yourself.
+Alternatively, instead of providing an entire template for the feed you can
+extend them by [overriding a
+block](@/documentation/themes/extending-a-theme.md#overriding-a-block). The
+Atom template provides a block named `atom_entry_extra`, while the rss template
+has the block `rss_item_extra`. These blocks allow you to extend the content of
+each item that goes into the feed.
+
**Only pages with a date will be available.**
The feed template gets five variables:
diff --git a/test_site/config.toml b/test_site/config.toml
index e3fcbfd64d..4694d39b35 100644
--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -7,6 +7,7 @@ theme = "sample"
taxonomies = [
{name = "categories", feed = true},
{name = "podcast_authors", feed = true},
+ {name = "tags", feed = true},
]
ignored_content = ["*/ignored.md"]
diff --git a/test_site/content/posts/with-tag-taxonomy.md b/test_site/content/posts/with-tag-taxonomy.md
new file mode 100644
index 0000000000..21758e08e2
--- /dev/null
+++ b/test_site/content/posts/with-tag-taxonomy.md
@@ -0,0 +1,10 @@
++++
+title = "A post with tags"
+description = ""
+date = 2023-07-29
+
+[taxonomies]
+tags = ["foo tag", "bar tag"]
++++
+
+This post has a `tags` taxonomy.
diff --git a/test_site/templates/atom.xml b/test_site/templates/atom.xml
new file mode 100644
index 0000000000..e92c4271fe
--- /dev/null
+++ b/test_site/templates/atom.xml
@@ -0,0 +1,11 @@
+{% extends "atom.xml" %}
+
+{% block atom_entry_extra %}
+
+{%- if page.taxonomies and page.taxonomies.tags %}
+{%- for tag in page.taxonomies.tags %}
+
+{% endfor -%}
+{% endif -%}
+
+{% endblock atom_entry_extra %}
diff --git a/test_site/templates/rss.xml b/test_site/templates/rss.xml
new file mode 100644
index 0000000000..f44464b9c8
--- /dev/null
+++ b/test_site/templates/rss.xml
@@ -0,0 +1,11 @@
+{% extends "rss.xml" %}
+
+{% block rss_item_extra %}
+
+{%- if page.taxonomies and page.taxonomies.tags %}
+{%- for tag in page.taxonomies.tags %}
+{{ tag }}
+{% enfor -%}
+{% endif -%}
+
+{% endblock rss_item_extra %}