<p>What I would do is create a structure <code>siteUrls</code> which is responsible for page urls. Top-level entries have url of <code>{slug}</code>, nested entries have url of <code>{parent.uri}/{slug}</code>. The top-level entry with slug <em>blog</em> will be the entry with url <em>/blog</em>. Then you can have an entry type of <code>blogLandingPage</code> and use that entry type for this entry.</p>

<p>The other piece of the puzzle is getting the right template for the <code>blogLandingPage</code>. The trick for this is to use a feature of the <a href="http://twig.sensiolabs.org/doc/tags/include.html" rel="nofollow">twig include tag</a>:</p>

<blockquote>
  <p>New in version 1.2: The possibility to pass an array of templates has been added in Twig 1.2.</p>
  
  <p>You can also provide a list of templates that are checked for existence before inclusion. The first template that exists will be included:</p>
</blockquote>

<p>So your template for  <code>siteUrls</code> will look like:</p>

<pre><code>{% include ['_siteUrls/'~entry.type, '_siteUrls/default'] %}
</code></pre>

<p>And the template for entries (like this one) with type <code>blogLandingPage</code> is <em>_siteUrls/blogLandingPage</em>. Using a list for the <code>{% include %}</code> means some entry types can share templates, and thing fail more gracefully if you have an entry type without a matching template.</p>

CC BY-SA 3.0
2014-09-04T19:47:42.340Z
2014-09-04T19:47:42.340Z
Marion Newlevant
<p>Not 100% sure I follow what you're trying to do, but here's what I'd suggest (based on my interpretation)...</p>

<ol>
<li>Create an actual template, either <code>blog.html</code> or <code>blog/index.html</code>.</li>
<li>In that template, write a couple simple lines of Twig code which will (A) determine which page they are supposed to be routed to, then (B) <a href="http://buildwithcraft.com/docs/templating/redirect" rel="nofollow">redirect to that page</a>.</li>
</ol>

CC BY-SA 3.0
2014-09-04T05:11:16.363Z
I was trying to avoid that. The client would like control over creating routes "for ease of marketing" urls. I was curious if the routes module in the CP had a way of creating these routes. I suspected not, because they link to a specific template not url. Thanks for your response Lindsey.
a-am
CC BY-SA 3.0
2014-09-04T05:15:59.423Z
You're very welcome Aran! Unfortunately you're right, I don't think there's a way to easily manage routes to a non-static template. You could also setup some fancy routing up via the `config/routes.php` file, but that also denies the client of their "ease of marketing" desire.
Lindsey D
CC BY-SA 3.0
2014-09-04T05:06:27.840Z
2014-09-04T05:06:27.840Z
Lindsey D
<p>I have a structure setup with parents and children.  Can a route be setup in the CP to route a generic url to a specific parent or child of the structure.  For example I have a blog landing page that is a child of the structure.  Can a route be setup, so when a user enters at /blog it takes them to that landing page?</p>

<routes>
Routing generic urls to sections or structures urls
# Routing generic urls to sections or structures urls

(Asked by: username_0 on 2014-09-03)

I have a structure setup with parents and children. Can a route be setup in the CP to route a generic url to a specific parent or child of the structure. For example I have a blog landing page that is a child of the structure. Can a route be setup, so when a user enters at /blog it takes them to that landing page?

**Tags:** routes


---

## 2 answers

### Answer by username_1 on 2014-09-04. Score: 3

What I would do is create a structure siteUrls which is responsible for page urls. Top-level entries have url of {slug}, nested entries have url of {parent.uri}/{slug}. The top-level entry with slug blog will be the entry with url /blog. Then you can have an entry type of blogLandingPage and use that entry type for this entry.
The other piece of the puzzle is getting the right template for the blogLandingPage. The trick for this is to use a feature of the twig include tag:

New in version 1.2: The possibility to pass an array of templates has been added in Twig 1.2.
You can also provide a list of templates that are checked for existence before inclusion. The first template that exists will be included:

So your template for  siteUrls will look like:
{% include ['_siteUrls/'~entry.type, '_siteUrls/default'] %}

And the template for entries (like this one) with type blogLandingPage is _siteUrls/blogLandingPage. Using a list for the {% include %} means some entry types can share templates, and thing fail more gracefully if you have an entry type without a matching template.


---

### Answer by username_2 on 2014-09-04. Score: 2

Not 100% sure I follow what you're trying to do, but here's what I'd suggest (based on my interpretation)...

1. Create an actual template, either `blog.html` or `blog/index.html`.
2. In that template, write a couple simple lines of Twig code which will (A) determine which page they are supposed to be routed to, then (B) [redirect to that page](http://buildwithcraft.com/docs/templating/redirect).

> **Comments:**
> **username_0**: I was trying to avoid that. The client would like control over creating routes "for ease of marketing" urls. I was curious if the routes module in the CP had a way of creating these routes. I suspected not, because they link to a specific template not url. Thanks for your response Lindsey.  
> **username_2**: You're very welcome Aran! Unfortunately you're right, I don't think there's a way to easily manage routes to a non-static template. You could also setup some fancy routing up via the `config/routes.php` file, but that also denies the client of their "ease of marketing" desire.  

---

