<p>I just used {% header %} and changed it to application/xml instead of application/rss+xml and got the result I was expecting. </p>

CC BY-SA 3.0
2014-11-10T06:49:02.473Z
2014-11-10T06:49:02.473Z
Chris
<p>I made an article about RSS feed template component for Craft CMS - you can read it here:</p>

<p><a href="http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms" rel="nofollow noreferrer">http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms</a></p>

CC BY-SA 4.0
2021-04-19T17:02:31.237Z
Hi there - love your example - I was just wondering if there is anyway to make it so you could add the websites address to a RSS aggregator and it would find the RSS link if its avalible? So far your boilerplate code allows me to reference the RSS to a agrigator but I have to give it the absolute file path i.e. example.com/feed.rss instead of example.com/resources for example
Wally
CC BY-SA 4.0
2019-03-29T00:15:44.087Z
2019-03-29T00:15:44.087Z
Piotr Pogorzelski
<p>Here's the boilerplate I've been using for RSS feed templates. I just name the file rss.html and call it a day. </p>

<p>This assumes a channel is set up with a description and title field. </p>

<pre><code>{% header "Content-Type: application/rss+xml" %}
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"&gt;

{% set rss = craft.entries({ section: 'yourChannel' }) %}

&lt;channel&gt;
  &lt;title&gt;Title Your RSS Feed&lt;/title&gt;
  &lt;link&gt;http://www.yourlink.com/&lt;/link&gt;
  &lt;description&gt;Enter a description here&lt;/description&gt;
  &lt;language&gt;en-us&lt;/language&gt;
  &lt;atom:link href="{{ url() }}" rel="self" type="application/rss+xml" /&gt;

  {% for item in rss %}
  &lt;item&gt;
    &lt;title&gt;{{ item.title }}&lt;/title&gt;
    &lt;link&gt;{{ item.url() }}&lt;/link&gt;
    &lt;description&gt;{{ item.description }}&lt;/description&gt;
    &lt;pubDate&gt;{{ item.postDate.rfc2822() }}&lt;/pubDate&gt;
    &lt;guid&gt;{{ item.url() }}&lt;/guid&gt;
  &lt;/item&gt;
  {% endfor %}
&lt;/channel&gt;

&lt;/rss&gt;
</code></pre>

CC BY-SA 3.0
2015-03-12T10:47:27.677Z
In other locales than english, `date('r')` seems to be translated and no longer results in a valid RSS feed — use `item.postDate.rfc2822()` instead.
Avant la lettre
CC BY-SA 3.0
2016-03-30T06:33:52.850Z
I have used that plugin but confused how to use it and add field. https://www.us-cert.gov/ncas/all.xml this is what i want to extract
Dinesh Saini
CC BY-SA 3.0
2016-10-17T16:32:53.630Z
Make sure to use the escape filter on whatever you're plugging in to the description field: `{% set description = description|e %}`, because RSS feeds can break with stuff like &nbsp; that appear in rich text field.
4midori
CC BY-SA 3.0
2014-11-10T09:23:12.713Z
2015-03-13T18:16:20.537Z
2015-03-13T18:16:20.537Z
Jason D
<p>Do you only have to build the .rss template file and then you use that URL for your RSS feed? Based on the documentation at hand, that's what it seems like. </p>

<p>I'm attempting to parse an RSS feed using the Google Feed API (<a href="https://developers.google.com/feed/">https://developers.google.com/feed/</a>) and it's having issues reading the output - so I just want to see if anyone else out there is using RSS in Craft so I can see their output vs mine. When I view mine, it doesn't look like a traditional xml output. </p>

CC BY-SA 4.0
2018-10-29T06:22:15.370Z
I am facing issues to read external RSS feed which is `<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
` If I create a plain php file with the parsing code, it works fine and returns me the array of feed, but if I put it in plugin controller, it is giving me an empty array.
So if anyone has any clues, or reference, please give me. I am trying to achieve it since 4 days now.
Himanshu Upadhyay
<rss>
Any working RSS feed examples out there?
# Any working RSS feed examples out there?

(Asked by: username_0 on 2014-11-10)

Do you only have to build the .rss template file and then you use that URL for your RSS feed? Based on the documentation at hand, that's what it seems like.

I'm attempting to parse an RSS feed using the Google Feed API (<https://developers.google.com/feed/>) and it's having issues reading the output - so I just want to see if anyone else out there is using RSS in Craft so I can see their output vs mine. When I view mine, it doesn't look like a traditional xml output.

**Tags:** rss

> **Comments:**
> **username_1**: I am facing issues to read external RSS feed which is `<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0"> ` If I create a plain php file with the parsing code, it works fine and returns me the array of feed, but if I put it in plugin controller, it is giving me an empty array. So if anyone has any clues, or reference, please give me. I am trying to achieve it since 4 days now.  

---

## 3 answers

### Answer by username_4 on 2014-11-10. Score: 17 | Accepted answer

Here's the boilerplate I've been using for RSS feed templates. I just name the file rss.html and call it a day. 
This assumes a channel is set up with a description and title field. 
{% header "Content-Type: application/rss+xml" %}



{% set rss = craft.entries({ section: 'yourChannel' }) %}


  Title Your RSS Feed
  http://www.yourlink.com/
  Enter a description here
  en-us
  

  {% for item in rss %}
  
    {{ item.title }}
    {{ item.url() }}
    {{ item.description }}
    {{ item.postDate.rfc2822() }}
    {{ item.url() }}
  
  {% endfor %}

> **Comments:**
> **username_5**: In other locales than english, `date('r')` seems to be translated and no longer results in a valid RSS feed — use `item.postDate.rfc2822()` instead.  
> **username_6**: I have used that plugin but confused how to use it and add field. https://www.us-cert.gov/ncas/all.xml this is what i want to extract  
> **username_7**: Make sure to use the escape filter on whatever you're plugging in to the description field: `{% set description = description|e %}`, because RSS feeds can break with stuff like &nbsp; that appear in rich text field.  

---

### Answer by username_0 on 2014-11-10. Score: 3

I just used {% header %} and changed it to application/xml instead of application/rss+xml and got the result I was expecting.


---

### Answer by username_2 on 2019-03-29. Score: 2

I made an article about RSS feed template component for Craft CMS - you can read it here:

<http://craftsnippets.com/articles/rss-feed-template-component-for-craft-cms>

> **Comments:**
> **username_3**: Hi there - love your example - I was just wondering if there is anyway to make it so you could add the websites address to a RSS aggregator and it would find the RSS link if its avalible? So far your boilerplate code allows me to reference the RSS to a agrigator but I have to give it the absolute file path i.e. example.com/feed.rss instead of example.com/resources for example  

---

