# Creating a single-purpose RSS feed

**URL:** <https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094>\
**Category:** support\
**Created:** [March 19, 2018, 12:42am UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094 "2018-03-19T00:42:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [March 19, 2018, 12:42am UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/1 "2018-03-19T00:42:58Z")

</div>

I have an existing site with an RSS feed at /index.xml for blog posts, which I don’t want to change. I want to create a couple of new RSS feeds for specific purposes:

The first is the same posts as the standard RSS feed, but instead of using .Content it will use .Summary. I want this to be located at /summary.xml

The second will have only specific pages on a topic (say, penguins) and will be located at, say, /penguins.xml. I’m planning to create a “menu” and in each page’s front matter that I want in this feed, I’ll just say “menu: penguins” and then reference that menu in the RSS template.

My question is not how to write the templates - that seems easy and I’m having no trouble copying and modifying the standard RSS template - my question is how to get the rendered site to have these specific paths and content. I’m having no luck searching; perhaps I haven’t thought of the right search terms. I’ve tried a few options, without success:

1. Put a file into /content/summary.xml, for example, and put template code in it. Doesn’t work, it just gets copied as a static file to the output.
2. Put a file into /static/summary.xml, but the same problem happens.
3. Put a markdown file into /content, mostly empty and perhaps just with front matter; and let it be rendered with a template where the logic will live; but it’s not a page or blog; what content type would I specify for it? Not sure where to start with this idea.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 19, 2018, 7:48am UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/2 "2018-03-19T07:48:47Z")

</div>

For this you would have to look into [https://gohugo.io/templates/output-formats](https://gohugo.io/templates/output-formats)

The normal use case is to define RSS as an extra output format for a given page, but if you want many feeds, you may want to just create a bunch of “single pages” and set `outputs` and either `Type` or `Layout` in front matter to pick the correct template.

---

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [March 19, 2018, 3:20pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/3 "2018-03-19T15:20:55Z")

</div>

Thank you! Let me check if I understand. I’ll focus just on the penguins feed as an example. If I can get this working I’m sure I can do the other one too. I’ll take the following steps:

1. Create `content/penguins.md` with the following contents:  
—  
date: 2018-03-19  
layout: penguins  
outputs:  
- rss  
—
2. Create `layouts/penguins/list.xml` with contents like the following:  
`<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> ... {{ range first 20 .Site.Menus.penguins }} ...`

But how do I get Hugo to render this single page `penguins.md` with the list layout template? I’m not sure about that.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 19, 2018, 3:47pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/4 "2018-03-19T15:47:56Z")

</div>

- Your penguins.md will resolve to a regular page in Hugo (single page, leaf page, many names …)
- See [https://gohugo.io/templates/lookup-order/](https://gohugo.io/templates/lookup-order/)
- So, you have `Type` (defaults to section) and `Layout` you can use to control what template. With your example a layout in layouts/\_default/penguins.xml should work, but there are many options here.

---

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [March 19, 2018, 10:59pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/5 "2018-03-19T22:59:06Z")

</div>

I’m a little confused. Should I set `type: section` and `layout: penguins` in front matter to get it to choose that template?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 19, 2018, 11:07pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/6 "2018-03-19T23:07:47Z")

</div>

No …

So, Hugo tries to find _the most specific template_.

We use `Type` and `Layout` as some of the criterias.

`Layout` is considered “most specific” – so no need to mess with other settings if that is good enough.

---

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [March 25, 2018, 1:59pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/7 "2018-03-25T13:59:12Z")

</div>

Thanks. I’m still working on deciding the best way to do this from the several options. One option for the penguins feed, for example, is simply to create a new taxonomy and have it rendered only as RSS, so each post that I want in the penguins RSS feed could simply add this in the front matter. This is seeming like a simpler way to go at the moment:

```
feeds:
- Penguins
```

---

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [September 15, 2018, 7:41pm UTC](https://discourse.gohugo.io/t/creating-a-single-purpose-rss-feed/11094/8 "2018-09-15T19:41:23Z")

</div>

**SOLVED** It took a while but I got around to doing this. It was pretty simple, I was just confused about the different options and how they were different from each other.

Short version: create a content file with a `layout` parameter in front matter. The value of that parameter should match the name of a layout file under `layouts/_default/`.

Real example Git commit where I got this working: [https://github.com/xaprb/story/commit/6e31bfaf5afbabfcb184447454d7e2801f67fd9c](https://github.com/xaprb/story/commit/6e31bfaf5afbabfcb184447454d7e2801f67fd9c) This produces a special-purpose RSS feed at the URL `/mailchimp/index.xml`
