I have an {% include%} which displays entries from a structure. This {% include%} is displayed on the homepage and other entries throughout the site.
On the homepage, I'd like the include to show a specific title. On the other entries, I'd like it to show a different title.
Here's what I've tried:
{% if craft.request.getUrl() == "/" %}
<h2>Homepage Title</h2>
{% else %}
<h2>Other Title</h2>
{% endif %}
Both titles appear on the homepage, but the {% else %}
title appears correctly on the other entries. What am I doing wrong here?
Here's the code from the include file:
<div class="grid specialties">
{% if craft.request.getUrl() == siteUrl %}
<h2>Homepage Title</h2>
{% else %}
<h2>Other Title</h2>
{% endif %}
{% for entry in craft.entries.section('feed').find() %}
<article class="fifth">
<a href="{{ entry.url }}">
{% set image = entry.icon.first() %}
<img src="{{ image.url }}" alt="{{ image.title }}">
{% endif %}
<h3>{{ entry.title }}</h3>
</a>
</article>
{% endfor %}
</div>
Here's the homepage code:
{% extends "_layout" %}
{% block content %}
{% include "_includes/layout_builder" %}
{% include "_includes/specialties" %}
{% endblock %}