<p>It sounds like you need to create a dynamic route by going to <strong>Settings > Routes > "New Route"</strong>.  Then you'd set your custom route to <code>profiles/{slug}/email-signature</code> and decide which template to serve when the url looks that way.  </p>

<p>You can either serve the <code>_entry</code> template you're serving for <code>/profiles/john-doe</code> or create a new one. Depending on the situation, you may need to set the entry in the template like...</p>

<pre><code>{% set person = craft.request.getSegment(2) %}
{% set entry = craft.entries.section('profiles').slug(person).first %}
</code></pre>

<p>...in the event Craft can't figure it out because you're on a separate template.  Grabbing segment 2 means you're grabbing <code>john-doe</code> from the URL, which will help Craft know which entry to find.</p>

<p>Here's more info on routing in the docs: <a href="https://craftcms.com/docs/routing#dynamic-routes" rel="nofollow noreferrer">https://craftcms.com/docs/routing#dynamic-routes</a></p>

CC BY-SA 3.0
2017-09-14T22:48:42.950Z
2017-09-14T22:55:28.280Z
2017-09-14T22:55:28.280Z
Ryan
<p>This should be a comment on Ryan's answer, but I don't have the necessary reputation to post it.</p>

<p>If you're using a custom route like <code>profiles/{slug}/email-signature</code> then you don't need to use <code>getSegment(2)</code> to access the person. The whole point is that your setting the <code>slug</code> variable during the routing so should be able to just use <code>{{ slug }}</code> in the template that the route is pointed at.</p>

<p>So you'd just need:
<code>{% set entry = craft.entries.section('profiles').slug(slug).first %}</code></p>

CC BY-SA 3.0
2017-09-15T21:24:58.367Z
2017-09-15T21:24:58.367Z
Digital Squid
<p>I created a Profile structure for my client's employees. He asked if I could generate an email signature for them from their Profile. I figured out a way to put all the signatures on one page using a</p>

<pre><code>{% for entry in craft.entries.section('profiles') %}
</code></pre>

<p>loop on a single page.</p>

<p>However, is there a way to give each person their own page for an email signature? <code>/PROFILE/email-signature</code> that pulls content from the profile. I want this to update dynamically as he adds/removes employees.</p>

<p>How would I create a secondary template for the profiles for an email-signature?</p>

CC BY-SA 3.0
2017-09-14T01:57:37.290Z
Are you just asking how to create the details template for an entry in your structure like `/profiles/john-doe` ? Or are you asking how to have both `/profiles/john-doe` AND `/profiles/john-doe/email-signature` and they are both connected to one "John Doe" profiles entry?
Ryan
CC BY-SA 3.0
2017-09-14T18:22:10.800Z
The second question... I need an email-signature page for every profile page, but still keep the profile pages.
Jeff Fulton
CC BY-SA 3.0
2017-09-14T22:56:17.010Z
Ah, that's just a dynamic routes issue then. Solution is posted below.
Ryan
<templating><routing>
Secondary Template for Structure
# Secondary Template for Structure

(Asked by: username_0 on 2017-09-13)

I created a Profile structure for my client's employees. He asked if I could generate an email signature for them from their Profile. I figured out a way to put all the signatures on one page using a
{% for entry in craft.entries.section('profiles') %}

loop on a single page.
However, is there a way to give each person their own page for an email signature? /PROFILE/email-signature that pulls content from the profile. I want this to update dynamically as he adds/removes employees.
How would I create a secondary template for the profiles for an email-signature?

**Tags:** templating, routing

> **Comments:**
> **username_1**: Are you just asking how to create the details template for an entry in your structure like `/profiles/john-doe` ? Or are you asking how to have both `/profiles/john-doe` AND `/profiles/john-doe/email-signature` and they are both connected to one "John Doe" profiles entry?  
> **username_0**: The second question... I need an email-signature page for every profile page, but still keep the profile pages.  
> **username_1**: Ah, that's just a dynamic routes issue then. Solution is posted below.  

---

## 2 answers

### Answer by username_1 on 2017-09-14. Score: 3 | Accepted answer

It sounds like you need to create a dynamic route by going to Settings > Routes > "New Route".  Then you'd set your custom route to profiles/{slug}/email-signature and decide which template to serve when the url looks that way.  
You can either serve the _entry template you're serving for /profiles/john-doe or create a new one. Depending on the situation, you may need to set the entry in the template like...
{% set person = craft.request.getSegment(2) %}
{% set entry = craft.entries.section('profiles').slug(person).first %}

...in the event Craft can't figure it out because you're on a separate template.  Grabbing segment 2 means you're grabbing john-doe from the URL, which will help Craft know which entry to find.
Here's more info on routing in the docs: https://craftcms.com/docs/routing#dynamic-routes


---

### Answer by username_2 on 2017-09-15. Score: 2

This should be a comment on username_1's answer, but I don't have the necessary reputation to post it.

If you're using a custom route like `profiles/{slug}/email-signature` then you don't need to use `getSegment(2)` to access the person. The whole point is that your setting the `slug` variable during the routing so should be able to just use `{{ slug }}` in the template that the route is pointed at.

So you'd just need:
`{% set entry = craft.entries.section('profiles').slug(slug).first %}`


---

