diff --git a/website/templates/layout.html b/website/templates/layout.html
index bec8dd74fc81..a3485e923c98 100644
--- a/website/templates/layout.html
+++ b/website/templates/layout.html
@@ -91,8 +91,22 @@
- {% if section and section.generate_feeds %}
-
+ {%- set c_is_section_with_feed = (section and section.generate_feeds) -%}
+
+ {% if page %}
+ {%- set c_parent_section = get_section(path=page.ancestors | last, metadata_only=true) -%}
+ {%- set c_is_page_in_feed = c_parent_section | get(key="generate_feeds") -%}
+ {% else %}
+ {%- set c_is_page_in_feed = false -%}
+ {% endif %}
+
+ {% if c_is_section_with_feed or c_is_page_in_feed %}
+ {% if c_is_section_with_feed %}
+ {%- set c_feed_path = section.path -%}
+ {% else %}
+ {%- set c_feed_path = c_parent_section.path -%}
+ {% endif %}
+
{% endif %}