I'm not sure what's wrong with this original markup:
Conditional One (doesn't work)
{% if entry.metaTitle is defined %}
{{ entry.metaTitle }}
{% elseif title is defined %}
{{ title }}
{% else %}
{{ siteName }}
{% endif %}
This works but seems a bit much for some simple checks:
Conditional Two (does work)
{% if entry.metaTitle is defined %}
{{ entry.metaTitle }}
{% endif %}
{% if (title is defined) and (entry.metaTitle is empty) %}
{{ title }}
{% endif %}
{% if (title is empty) and (entry.metaTitle is empty) %}
{{ siteName }}
{% endif %}
As you can see I'm checking first if metaTitle is set, then title then finally fallback to siteName. Entering data for the first two return results, but not sure why if metaTitle and title are empty why siteName doesn't return in the first conditional
#
Update based on Aaron's answer:
Tried this too:
{% if (entry.metaTitle is defined) and (entry.metaTitle is empty) %}
{{ entry.metaTitle }}
{% elseif title is defined %}
{{ title }}
{% else %}
{{ siteName }}
{% endif %}
#
Also tried this, Aaron was missing a ( in his answer :)
{% if (entry.metaTitle is defined) and (entry.metaTitle != '') %}
{{ entry.metaTitle }}
{% elseif title is defined %}
{{ title }}
{% else %}
{{ siteName }}
{% endif %}
But that doesn't work either with the same initial results.
entry.metaTitle != ''and notentry.metaTitle is empty, as that seems to make a difference. – Aaron Berkowitz Apr 02 '15 at 03:20title? – Aaron Berkowitz Apr 02 '15 at 03:32{% extends '_inc/_layout' %}{% set title = entry.heading %}– Mark Busnelli Jr Apr 02 '15 at 03:35titlehas no value:{{ title is defined ? 'defined' : 'not defined' }}– Brad Bell Apr 02 '15 at 03:49