<p>Okay, I think that I have figured it out. Posting here for posterity. Based on the requirement above, I put these in my routes.php file.</p>

<pre><code>'shows\/(?P&lt;parentSlug&gt;[a-zA-Z0-9\-\.]+)\/(?P&lt;childSlug&gt;[a-zA-Z0-9\-\.]+)\/feed' =&gt; 'categories/_shows.rss',
</code></pre>

<p>and</p>

<pre><code>'shows\/(?P&lt;parentSlug&gt;[a-zA-Z0-9\-\.]+)\/feed' =&gt; 'categories/_shows.rss',
</code></pre>

<p>This gives me two variables. parentSlug and childSlug </p>

CC BY-SA 3.0
2016-04-08T20:58:46.357Z
2016-04-08T20:58:46.357Z
David A McInnis
<p>I think that I need to set up a few routes to handle my category based RSS feeds. I have a current url structure as follows</p>

<pre><code>http://something.com/shows/wmr/marketing pr

http://something.com/categoryGroup/parentCategory/childCategory
</code></pre>

<p>I need rss feeds from both the parent and child categories</p>

<pre><code>http://something.com/categoryGroup/parentCategory/feed
http://something.com/categoryGroup/parentCategory/childCategory/feed
</code></pre>

<p>The rss template i am using is stored in </p>

<pre><code>categories/_shows.rss
</code></pre>

<p>I have munged something together in the cp routes settings but I would prefer to have this in routes.php. Having access to the parentCategory and childCategory values without doing a segments thing would be nice.</p>

CC BY-SA 3.0
2016-04-08T12:37:02.217Z
Have you tried using the URL features on the actual categories? You can provide both parent and child URL in there and point to your template
mcclaskiem
CC BY-SA 3.0
2016-04-08T17:06:12.797Z
@mcclaskiem I am not sure what that would look like. I think that I still need a route to handle the incoming request and forward it to the appropriate template. http://something.com/categoryGroup/parentCategory exists but http://something.com/categoryGroup/parentCategory/feed needs a route.
David A McInnis
<categories><routes>
Setting up Route for Category-based RSS Feeds
# Setting up Route for Category-based RSS Feeds

(Asked by: username_0 on 2016-04-08)

I think that I need to set up a few routes to handle my category based RSS feeds. I have a current url structure as follows
http://something.com/shows/wmr/marketing pr

http://something.com/categoryGroup/parentCategory/childCategory

I need rss feeds from both the parent and child categories
http://something.com/categoryGroup/parentCategory/feed
http://something.com/categoryGroup/parentCategory/childCategory/feed

The rss template i am using is stored in 
categories/_shows.rss

I have munged something together in the cp routes settings but I would prefer to have this in routes.php. Having access to the parentCategory and childCategory values without doing a segments thing would be nice.

**Tags:** categories, routes

> **Comments:**
> **username_1**: Have you tried using the URL features on the actual categories? You can provide both parent and child URL in there and point to your template  
> **username_0**: @username_1 I am not sure what that would look like. I think that I still need a route to handle the incoming request and forward it to the appropriate template. http://something.com/categoryGroup/parentCategory exists but http://something.com/categoryGroup/parentCategory/feed needs a route.  

---

## 1 answers

### Answer by username_0 on 2016-04-08. Score: 1

Okay, I think that I have figured it out. Posting here for posterity. Based on the requirement above, I put these in my routes.php file.
'shows\/(?P[a-zA-Z0-9\-\.]+)\/(?P[a-zA-Z0-9\-\.]+)\/feed' => 'categories/_shows.rss',

and
'shows\/(?P[a-zA-Z0-9\-\.]+)\/feed' => 'categories/_shows.rss',

This gives me two variables. parentSlug and childSlug


---

