<p>Try this - using {{ entry.section }} and {{ entry.slug }}</p>

<pre><code>{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}
{% for entry in row %}
    &lt;h2 class="product-card-title"&gt;&lt;a href="{{ entry.section}}/{{ entry.slug }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h2&gt;
    &lt;span class="product-card-desc"&gt;Product Description&lt;/span&gt;
    &lt;span class="product-card-price"&gt;{{ entry.price }}&lt;/span&gt;
{% endfor %}        
{% endfor %}
</code></pre>

CC BY-SA 3.0
2018-02-21T20:37:38.317Z
Thanks, that does indeed work, but I now need to get the template to match with the url as the slug consists of 2 parts (which is what I wanted) and using an entry-type template which matches the section is throwing a 404:

entry type handle is 'products'

and the template name is also 'products' which works for urls with one slug but not for the additional as desired?
Kev N
CC BY-SA 3.0
2018-02-21T20:48:22.190Z
I just changed the section url format setting to:

{section}/{slug}

and sorted
Kev N
CC BY-SA 3.0
2018-02-21T13:55:23.617Z
2018-02-21T13:55:23.617Z
CreateSean
<p>I would like to add the URL of the channel entry I have selected (atm 2 channels are available to choose from), so I would like a url like:</p>

<p><strong>summerhouses</strong>/product1</p>

<p>or</p>

<p><strong>greehnouses</strong>/product2</p>

<p>how would I modify the code below to achieve this? </p>

<p>The code below just shows: /product1</p>

<pre><code>{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}
{% for entry in row %}
    &lt;h2 class="product-card-title"&gt;&lt;a href="{{ entry.getUrl }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h2&gt;
    &lt;span class="product-card-desc"&gt;Product Description&lt;/span&gt;
    &lt;span class="product-card-price"&gt;{{ entry.price }}&lt;/span&gt;
{% endfor %}        
{% endfor %}
</code></pre>

<entry><url><relatedto>
Include the URL of a related entry field
# Include the URL of a related entry field

(Asked by: username_0 on 2018-02-21)

I would like to add the URL of the channel entry I have selected (atm 2 channels are available to choose from), so I would like a url like:
summerhouses/product1
or
greehnouses/product2
how would I modify the code below to achieve this? 
The code below just shows: /product1
{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}
{% for entry in row %}
    {{ entry.title }}
    Product Description
    {{ entry.price }}
{% endfor %}        
{% endfor %}

**Tags:** entry, url, relatedto


---

## 1 answers

### Answer by username_1 on 2018-02-21. Score: 1 | Accepted answer

Try this - using {{ entry.section }} and {{ entry.slug }}
{% for row in entry.homeFeaturedProducts.order('RAND()')|batch(4) %}
{% for entry in row %}
    {{ entry.title }}
    Product Description
    {{ entry.price }}
{% endfor %}        
{% endfor %}

> **Comments:**
> **username_0**: Thanks, that does indeed work, but I now need to get the template to match with the url as the slug consists of 2 parts (which is what I wanted) and using an entry-type template which matches the section is throwing a 404:  entry type handle is 'products'  and the template name is also 'products' which works for urls with one slug but not for the additional as desired?  
> **username_0**: I just changed the section url format setting to:  {section}/{slug}  and sorted  

---

