How do you combine several RSS feeds?

I have RSS feeds for some sections.

I’d like to these feeds to create a master RSS feed for the homepage.

In layout, I have:


In layout/rss.xml, I’d like to aggregate the feeds from products/rss.xml, notes/rss.xml and newspapers/rss.xml.

Suggestions? Thanks.

The default template is referenced in the docs at Modify {{ range .Pages }} to reference the sections you want; it is very customizable.


I assumed as much, but was hoping there was a better way to do this as I’ve already done the logic for each RSS feed.

If it helps anyone, here’s part of my code:

{{define "main"}}
  {{range where .Sections "Section" "in" (slice "products" "notes" "newspapers")}}
    {{range where .Pages "Layout" "==" ""}}
        <title>{{(cond (eq .Params.publisher nil) .Title (print .Params.publisher " - " .Title)) | htmlEscape}}</title>
          {{if eq .Section "products"}}
            {{htmlEscape .Summary | plainify}}
          {{else if eq .Section "notes"}}
            {{htmlEscape .Description | plainify}}
            {{$description := .Summary | default (partial "newspapers/printers.html" .)}}
            {{htmlEscape $description | plainify}}

This validates using the W3C Feed Validation Service. I tried just using html as per the doc examples but kept getting formatting errors from the validator so ended up with htmlEscape and plainify.

If there’s a better way to achieve the same result, let me know. I’m open to feedback!

Sorry if I get this wrong, but what about

{{range .RegularPages }}

? That will go through all your pages and create an RSS feed (if you replace it for the two range lines in your sample).

That feed will be large.

Some sidenotes:

  • I don’t understand why you have a RSS layout for each section, this might not be connected, but what changes between sections? - show us your code
  • what happens when you remove the second range line (that one creates items for only pages that have no layout set?)

I think best would be if you could publish a minimal repo with your layout files and some contents to go through…

1 Like