# Custom RSS feed by tag

**URL:** <https://community.hubspot.com/t/custom-rss-feed-by-tag/14315>\
**Category:** CMS Development\
**Created:** [May 10, 2019, 4:00am UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315 "2019-05-10T04:00:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cronhs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cronhs/32/78108_2.png) [@cronhs](https://community.hubspot.com/u/cronhs)\
**Post date:** [May 10, 2019, 4:00am UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/1 "2019-05-10T04:00:35Z")

</div>

Hi there. I am trying to work out how to create a custom RSS feed but instead of having it by most recent, be able to choose to show posts by a chosen tag, like the default RSS module allows you to do.

I know how to add in the selector to the module but not how to get the filter to actually work in the HTML + HUBL.

I did find this starter code for 3 posts in a row but this is by most recent

{% set rec\_posts = blog\_recent\_posts(‘default’, 3) %}  
\<div class=“row-fluid-wrapper”\>  
\<div class=“row-fluid”\>

{% for rec\_post in rec\_posts %}  
\<div class=“span4”\>  
\<a href=“{{rec\_post.absolute\_url}}”\>  
\<img src=“{{ rec\_post.post\_list\_summary\_featured\_image }}” alt=“{{ rec\_post.featured\_image\_alt\_text }}”\>  
\<h3\>{{ rec\_post.name }}\</h3\>  
\</a\>  
\</div\>

{% endfor %}  
\</div\>  
\</div\>

Any help?

---

<div class="post-metadata">

**Author:** ![Jenny](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jenny/32/24_2.png) [@Jenny](https://community.hubspot.com/u/Jenny)\
**Post date:** [May 20, 2019, 7:19pm UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/2 "2019-05-20T19:19:52Z")

</div>

Hi @cronhs,

Are you still looking for help with this?

Can you please share links, screenshots and examples that you have seen with the type of set up you are looking for?

I also wanted to share[this thread](https://community.hubspot.com/t5/CMS-Development/Is-it-possible-for-me-to-customise-my-RSS-feed-structure/td-p/43973), which discusses a similar topic.

Thank you,

Jenny

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [May 20, 2019, 9:46pm UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/3 "2019-05-20T21:46:14Z")

</div>

Hi @cronhs ,

You can do this in the custom module editor:

First, you will want to grab the code for the [blog\_recent\_tag\_posts](https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-recent-tag-posts) function from the HubL docs. That looks like this:

```auto
{% set tag_posts = blog_recent_tag_posts('default', 'marketing-tips', 5) %}
{% for tag_post in tag_posts %}
 <div class="post-title">{{ tag_post.name }}</div>
{% endfor %}

```

You can provide an option, for the topic to filter by, in the page editor by using a custom module text field. Create a plain text field in the module, and apply the token (not the snippet) where ‘marketing-tips’ is:

`{% set tag_posts = blog_recent_tag_posts('default', {{ text_field_value }}, 5) %}`

how this works is that you would enter a value to the text field in the editor. That value will print, as a string, where the token exists.  
There is a hangup here. If the value entered doesn’t register as a topic it will break the feed. It would be great if there was a “blog topics” field that supplied a drop down choice of blog topics, but that isn’t the case. The text field is the best option I have found, but user experience is iffy because the value entered has to exist, and also has to be correctly formated as lower case and dashes instead of spaces. While I do not have a solution for ensuring that the text entered is an available topic in your portal, I do have a solution for the formatting:

`{% set tag_posts = blog_recent_tag_posts('default', {{ text_field_value|lower|replace(' ', '-') }}, 5) %}`

using the HubL [lower](https://designers.hubspot.com/docs/hubl/hubl-supported-filters#hs_cos_wrapper_widget_2844609865) and [replace](https://designers.hubspot.com/docs/hubl/hubl-supported-filters#hs_cos_wrapper_widget_2839380048) filters You can convert text entered into the field into the proper format.

Let me know if that helps.

Need help? [Hire Us Here](https://www.upwork.com/o/companies/_~0124e15ff34efb3871/)

---

<div class="post-metadata">

**Author:** ![cronhs](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cronhs/32/78108_2.png) [@cronhs](https://community.hubspot.com/u/cronhs)\
**Post date:** [May 24, 2019, 6:07pm UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/4 "2019-05-24T18:07:55Z")

</div>

Thanks so much!

---

<div class="post-metadata">

**Author:** ![vanessabt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vanessabt/32/62359_2.png) [@vanessabt](https://community.hubspot.com/u/vanessabt)\
**Post date:** [September 29, 2020, 7:02pm UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/5 "2020-09-29T19:02:10Z")

</div>

Is there a way to pull this into a non-hubspot site and filter by tag?

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [October 14, 2020, 6:10pm UTC](https://community.hubspot.com/t/custom-rss-feed-by-tag/14315/6 "2020-10-14T18:10:32Z")

</div>

@vanessabt you can use the rss feed for your blog. I think topics come through the feed.
