if / elseif from base template I have a hero textbox that I would like to control from the base template using a simple if/elseif.

I have a field called "hero" for the homepage. For pages in the "Small Groups" section, I want the hero to say "Groups." For everything else, I want it to be the entry title.

It seems straightforward, but this isn't working? It is ignoring the elseif.

{% if entry == craft.entries.section('homepage') %}
    {{ entry.hero }}
{% elseif entry == craft.entries.section('smallgroups') %}
    Groups
{% else %}
    {{ entry.title }}
{% endif %}
Your issue is probably that you're actually comparing an EntryModel (entry) to an ElementCriteriaModel (the array-like object used for querying entries, which is returned by the craft.entries call).

Something like this should do it:

{% if entry.section.handle == 'homepage' %}
    {{ entry.hero }}
{% elseif entry.section.handle == 'smallgroups' %}
    Groups
{% else %}
    {{ entry.title }}
{% endif %}


Assuming your section handles are correct, the above should work – although this is a perfect use for using the {% switch %} tag instead of {% if %}, which in my opinion would make your code more readable:

{% switch entry.section.handle %}
    {% case 'homepage' %}
        {{ entry.hero }}
    {% case 'smallgroups' %}
        Groups
    {% default %}
        {{ entry.title }}
{% endswitch %}