<p>I think you're looking for <a href="http://buildwithcraft.com/docs/sections-and-entries#entry-types" rel="nofollow">entry types</a> - when you open a new 'services' entry you could pick from "service" or "service-information" entry types. Each entry type has it's own field layouts.</p>

<p>This would mean your URLs can follow the same structure without writing new routes etc.</p>

CC BY-SA 3.0
2015-05-16T18:36:05.990Z
Hiya, thanks for the answer. I'm not sure this is going to work though as I would definitely be having information pages all throughout the navigation hierarchy and so using entry types I would need to have a Services Information type, a Company Information type and so on and so forth. Not sure if entry-types can be shared between sections or not so if they can't then that would mean me having to repeat a lot of creation of fields and so on.
Unless there's a way around that at all?
Mark Bowen
CC BY-SA 3.0
2015-05-16T21:48:30.473Z
No, entry types can't be shared across sections. Even if you found yourself having to add identical "Information" entry types to all sections, you wouldn't have to repeat field creation, though – fields _can_ be shared across sections and entry types. You'd only have to repat _field layout_ creation, which is a much simpler process (especially if you're smart about your _field groups_).
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-05-16T12:03:18.747Z
2015-05-16T12:03:18.747Z
billythekid
<p><strong>The closest thing to EE's Structure module in Craft would be to build your site using a single Structure section w/ multiple entry types, and to set the URL format for that section to</strong> <code>{parent.uri}/{slug}</code>.</p>

<p>AFAIK, this is the only way to achieve both a site-wide, global hierarchy encompassing all content, as well as a uniform, hierarchical URL format for any content type.</p>

<p><em>Obviously though, dumping all your content in a single Section might not be ideal (depending on the complexity of your site).</em></p>

<p>Another approach – and this is the one I'd recommend – would be to create a separate "Navigation" or "Site structure" section with an Entry field (or use a plugin like <a href="https://github.com/am-impact/amnav" rel="nofollow">A&amp;M Nav</a> or <a href="https://github.com/familiar-studio/craft-menus" rel="nofollow">Menus</a>, which basically does the same thing but with more specific UI). </p>

<p>Obviously, this approach means that creating content and adding content to the site's navigation/structure hiearchy is a two-step process. This approach also doesn't solve your URL issue, as the structure you build for your "Navigation" structure won't carry over to its linked entries. I'd recommend letting that slide, but if you're determined to go the extra mile, you could possibly hack it like this:</p>

<ol>
<li>Set the "Navigation" section's URL format to <code>{{parent.uri}}/{slug}</code>, and add a template – <em>navItem.html</em> – to it.</li>
<li>Output your nav using the nav items' URI and not the linked entry's URI for the <code>href</code> attributes – i.e. you'll treat your "Navigation" entries' URIs as your entry permalinks</li>
<li>In the Navigation section's template – where all requests to the Navigation entries' URIs will end up – do something like this:</li>
</ol>

<p><em>navItem.html</em></p>

<pre><code>{# Cache the nav item entry to another variable #}
{% set navEntry = entry %}
{# Cache the linked entry to the "entry" variable (this assumes your Entry field for the Navigation section has the handle "linkedEntry" #}
{% set entry = navEntry.linkedEntry %}

{# Use a switch statement to include a different template based on the linked entry's section #}
{% switch entry.section.handle #}
    {% case 'services' %}
        {% include 'entry.services.html' %}
    ...
{% endswitch %}
</code></pre>

<p>Pretty cumbersome, and a hack for sure – but the effect would be that you'd have contextual, hierarchical URIs, whilst still retaining your content in separate sections.</p>

<p>I realise neither of these approaches are ideal, but right now I'm pretty sure those are your best options.</p>

CC BY-SA 3.0
2015-05-16T18:39:42.383Z
Hiya. If I set two sections to have the same URL format then I believe I'd still have the same problem as above wouldn't I? I would need these information pages in many different sections of the navigation and also different types of pages such as forms or maps and so on and so forth so if they pointed to services then that's not going to work for say the Company page. I'm sure I'm missing something obvious here but would really love to get things working pretty much the way they did with the Structure module in ExpressionEngine as that was a really nice way of working.
Mark Bowen
CC BY-SA 3.0
2015-05-16T21:32:31.963Z
Hello @MarkBowen – I interpreted your question to concern URLs, specifically. I just edited the answer to address what I now believe is your primary concern, i.e. how/if you can replicate EE's Structure module's behaviour in Craft.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-05-18T08:15:55.387Z
Hiya. Thanks for the help and the code. I'll try this out as soon as I can. Just wondering though what other people do in this sort of situation though? You mentioned 'letting it slide' so wondering are other people's clients okay with URLs that don't 'truly' reflect where a person is in the scheme of the site? I just always thought that it's best to have URLs that are not only easy to remember but also reflect the page you're on for SEO purposes too or is that not such a big concern any more?
Mark Bowen
CC BY-SA 3.0
2015-05-18T09:24:41.227Z
URLs are still important, for sure, though having a 1:1 relationship between your content and the presentation layer might be a little out of date - or at least a model neither EE nor Craft is really committed to, Structures aside. Personally I never really battle w/ your dilemma - the design/architecture of the site obviously matters, but I usually find that as long as that part is fairly well thought out, the URLs flow quite naturally.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-05-18T09:32:32.687Z
Usually, I'll put completely separate content in their own channels, and build the main nav separately using a Structure (or automatically in the template). Entry types, URL formats, relationships using Entry fields and the concept of _modular design_ (using Matrix fields) are also important structural building blocks. It's difficult to give solid advice without knowing more about your project, but note that there's nothing inherently _wrong_ w/ e.g. using a single Structure and many entry types, if that's what the design requires. It could get a little unwieldy, but so can an EE Structure :)
Mats Mikkel Rummelhoff
CC BY-SA 4.0
2021-08-30T13:01:42.587Z
I use a similar approach all the time, with an extra "template" field that pilots the switch and a "pageHandle" field wich can be used to recall a specific page URL. Works very well but the drawback is that content editors can seriously mess up the site if they're not careful/ignore warning labels.
gioppe
CC BY-SA 3.0
2015-05-16T12:16:47.463Z
2015-05-16T21:51:25.607Z
2015-05-16T21:51:25.607Z
Mats Mikkel Rummelhoff
<p>I have an existing ExpressionEngine site which I'm looking at moving to using Craft instead. </p>

<p>Only really had a quick cursory glance at the system so far but a little confused on a few things. </p>

<p>Say I have top level menu with items such as</p>

<p>Home
Services
Company</p>

<p>For instance let's say in the services menu there are some subpages such as :</p>

<p>Service 1
Service 2</p>

<p>and so on and so forth. On the existing site we are using the Structure module which allowed each of those services to have a url such as :</p>

<p><a href="http://www.mysite.com/services/service_1" rel="nofollow">http://www.mysite.com/services/service_1</a></p>

<p>and so on. That's all fine so far as long as each item in that menu is a service. Now let's say for arguments sake that we want a standard informational page thrown into that menu. From what I see so far with Craft (really hoping I'm wrong on this though) if I create say an information section and then link to that in my navigation then I'm going to end up with something like:</p>

<p><a href="http://www.mysite.com/information/my_information_page" rel="nofollow">http://www.mysite.com/information/my_information_page</a></p>

<p>What I'd like to end up with however would be :</p>

<p><a href="http://www.mysite.com/services/my_information_page" rel="nofollow">http://www.mysite.com/services/my_information_page</a></p>

<p>This makes more sense to me with the menus and URLs for people to remember. </p>

<p>I know I must be missing something obvious here but just not quite seeing what yet? </p>

<p>The above is just a very literal example but the whole site is like this in that the subsections can contain any kind of content but they still follow a good URL scheme. </p>

<p>Thanks in advance for any help with this. </p>

<p>Best wishes,</p>

<p>Mark</p>

<url><navigation><sections>
Custom navigation URLs?
# Custom navigation URLs?

(Asked by: username_0 on 2015-05-16)

I have an existing ExpressionEngine site which I'm looking at moving to using Craft instead.

Only really had a quick cursory glance at the system so far but a little confused on a few things.

Say I have top level menu with items such as

Home
Services
Company

For instance let's say in the services menu there are some subpages such as :

Service 1
Service 2

and so on and so forth. On the existing site we are using the Structure module which allowed each of those services to have a url such as :

<http://www.mysite.com/services/service_1>

and so on. That's all fine so far as long as each item in that menu is a service. Now let's say for arguments sake that we want a standard informational page thrown into that menu. From what I see so far with Craft (really hoping I'm wrong on this though) if I create say an information section and then link to that in my navigation then I'm going to end up with something like:

<http://www.mysite.com/information/my_information_page>

What I'd like to end up with however would be :

<http://www.mysite.com/services/my_information_page>

This makes more sense to me with the menus and URLs for people to remember.

I know I must be missing something obvious here but just not quite seeing what yet?

The above is just a very literal example but the whole site is like this in that the subsections can contain any kind of content but they still follow a good URL scheme.

Thanks in advance for any help with this.

Best wishes,

Mark

**Tags:** url, navigation, sections


---

## 2 answers

### Answer by username_1 on 2015-05-16. Score: 4

I think you're looking for [entry types](http://buildwithcraft.com/docs/sections-and-entries#entry-types) - when you open a new 'services' entry you could pick from "service" or "service-information" entry types. Each entry type has it's own field layouts.

This would mean your URLs can follow the same structure without writing new routes etc.

> **Comments:**
> **username_0**: Hiya, thanks for the answer. I'm not sure this is going to work though as I would definitely be having information pages all throughout the navigation hierarchy and so using entry types I would need to have a Services Information type, a Company Information type and so on and so forth. Not sure if entry-types can be shared between sections or not so if they can't then that would mean me having to repeat a lot of creation of fields and so on. Unless there's a way around that at all?  
> **username_2**: No, entry types can't be shared across sections. Even if you found yourself having to add identical "Information" entry types to all sections, you wouldn't have to repeat field creation, though – fields _can_ be shared across sections and entry types. You'd only have to repat _field layout_ creation, which is a much simpler process (especially if you're smart about your _field groups_).  

---

### Answer by username_2 on 2015-05-16. Score: 2

The closest thing to EE's Structure module in Craft would be to build your site using a single Structure section w/ multiple entry types, and to set the URL format for that section to {parent.uri}/{slug}.
AFAIK, this is the only way to achieve both a site-wide, global hierarchy encompassing all content, as well as a uniform, hierarchical URL format for any content type.
Obviously though, dumping all your content in a single Section might not be ideal (depending on the complexity of your site).
Another approach – and this is the one I'd recommend – would be to create a separate "Navigation" or "Site structure" section with an Entry field (or use a plugin like A&M Nav or Menus, which basically does the same thing but with more specific UI). 
Obviously, this approach means that creating content and adding content to the site's navigation/structure hiearchy is a two-step process. This approach also doesn't solve your URL issue, as the structure you build for your "Navigation" structure won't carry over to its linked entries. I'd recommend letting that slide, but if you're determined to go the extra mile, you could possibly hack it like this:

Set the "Navigation" section's URL format to {{parent.uri}}/{slug}, and add a template – navItem.html – to it.
Output your nav using the nav items' URI and not the linked entry's URI for the href attributes – i.e. you'll treat your "Navigation" entries' URIs as your entry permalinks
In the Navigation section's template – where all requests to the Navigation entries' URIs will end up – do something like this:

navItem.html
{# Cache the nav item entry to another variable #}
{% set navEntry = entry %}
{# Cache the linked entry to the "entry" variable (this assumes your Entry field for the Navigation section has the handle "linkedEntry" #}
{% set entry = navEntry.linkedEntry %}

{# Use a switch statement to include a different template based on the linked entry's section #}
{% switch entry.section.handle #}
    {% case 'services' %}
        {% include 'entry.services.html' %}
    ...
{% endswitch %}

Pretty cumbersome, and a hack for sure – but the effect would be that you'd have contextual, hierarchical URIs, whilst still retaining your content in separate sections.
I realise neither of these approaches are ideal, but right now I'm pretty sure those are your best options.

> **Comments:**
> **username_0**: Hiya. If I set two sections to have the same URL format then I believe I'd still have the same problem as above wouldn't I? I would need these information pages in many different sections of the navigation and also different types of pages such as forms or maps and so on and so forth so if they pointed to services then that's not going to work for say the Company page. I'm sure I'm missing something obvious here but would really love to get things working pretty much the way they did with the Structure module in ExpressionEngine as that was a really nice way of working.  
> **username_2**: Hello @MarkBowen – I interpreted your question to concern URLs, specifically. I just edited the answer to address what I now believe is your primary concern, i.e. how/if you can replicate EE's Structure module's behaviour in Craft.  
> **username_0**: Hiya. Thanks for the help and the code. I'll try this out as soon as I can. Just wondering though what other people do in this sort of situation though? You mentioned 'letting it slide' so wondering are other people's clients okay with URLs that don't 'truly' reflect where a person is in the scheme of the site? I just always thought that it's best to have URLs that are not only easy to remember but also reflect the page you're on for SEO purposes too or is that not such a big concern any more?  
> **username_2**: URLs are still important, for sure, though having a 1:1 relationship between your content and the presentation layer might be a little out of date - or at least a model neither EE nor Craft is really committed to, Structures aside. Personally I never really battle w/ your dilemma - the design/architecture of the site obviously matters, but I usually find that as long as that part is fairly well thought out, the URLs flow quite naturally.  
> **username_2**: Usually, I'll put completely separate content in their own channels, and build the main nav separately using a Structure (or automatically in the template). Entry types, URL formats, relationships using Entry fields and the concept of _modular design_ (using Matrix fields) are also important structural building blocks. It's difficult to give solid advice without knowing more about your project, but note that there's nothing inherently _wrong_ w/ e.g. using a single Structure and many entry types, if that's what the design requires. It could get a little unwieldy, but so can an EE Structure :)  
> **username_3**: I use a similar approach all the time, with an extra "template" field that pilots the switch and a "pageHandle" field wich can be used to recall a specific page URL. Works very well but the drawback is that content editors can seriously mess up the site if they're not careful/ignore warning labels.  

---

