<p>Sorry... while searching for an answer to something else I discovered the solution to this :/</p>

<pre><code>{% if craft.request.getSegment(1) != index.uri %}

    .... leave this chunk of code out

{% endif %}
</code></pre>

CC BY-SA 3.0
2015-10-16T10:31:55.703Z
2015-10-16T15:39:58.310Z
2015-10-16T15:39:58.310Z
Martin
<p>I have a site consisting of 15 templates, all of which extend <code>_layout.html</code>.  There is just one page (homepage) which needs to omit a chunk of the <code>_layout.html</code>.  Is there something I can add to <code>_layout</code> which says "if I'm on the homepage leave this chunk of code out"?</p>

<p>Many thanks</p>

<p>Martin</p>

<templating><segments>
Filter out part of _layout on a specific template
# Filter out part of _layout on a specific template

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

I have a site consisting of 15 templates, all of which extend `_layout.html`. There is just one page (homepage) which needs to omit a chunk of the `_layout.html`. Is there something I can add to `_layout` which says "if I'm on the homepage leave this chunk of code out"?

Many thanks

username_0

**Tags:** templating, segments


---

## 1 answers

### Answer by username_0 on 2015-10-16. Score: 1

Sorry... while searching for an answer to something else I discovered the solution to this :/
{% if craft.request.getSegment(1) != index.uri %}

    .... leave this chunk of code out

{% endif %}


---

