<p>Instead of using <code>{% if page.pageIntroText|length %}</code> have you tried </p>

<p><code>{% if page.pageIntroText is not empty %}</code></p>

CC BY-SA 3.0
2015-10-27T19:47:57.600Z
Thanks for your suggestion...  it didn't work.  I now have this: 
        {% nav page in subnav  %}
          <li>
            {% if page.pageIntroText is not empty %}
              <a href="{{ page.url }}">{{ page.title }}</a>
            {% else %}
            {{ page.title }}
            {% endif %}
          </li>
        {% endnav %}
Martin
CC BY-SA 3.0
2015-10-27T19:50:49.120Z
Bizarre!  I've just tried using a different field for the conditional and it's worked fine???
Martin
CC BY-SA 3.0
2015-10-27T20:04:18.307Z
What type of input is *pageIntroText*? I assumed it was Plain or Rich Text.
a-am
CC BY-SA 3.0
2015-10-28T04:32:24.963Z
I'm an idiot! I have two fields, pageIntroText and practiceIntroText, this section is querying practiceIntroText.  Thanks for your help :/
Martin
CC BY-SA 3.0
2015-10-27T15:15:17.497Z
2015-10-27T15:31:21.873Z
2015-10-27T15:31:21.873Z
a-am
<p>I'm using <a href="https://craftcms.stackexchange.com/questions/11443/show-only-children-of-current-page-in-submenu">this solution</a> to output the children within a current structure entry.  Unfortunately I need to take out the anchor on some entries that don't yet have content, but still include the (unlinked) title.</p>

<p>I'm trying the following</p>

<pre><code>{% nav page in subnav  %}
  {% if page.id != entry.id %}
  &lt;li&gt;{% if page.pageIntroText|length %}&lt;a href="{{ page.url }}"&gt;{%endif%}{{ page.title }}{% if page.pageIntroText|length %}&lt;/a&gt;{%endif%}&lt;/li&gt;
  {%else%}
  &lt;li class="current-page"&gt;{{ page.title }}&lt;/li&gt;{%endif%}
{% endnav %}
</code></pre>

<p>.. but it removes the anchor regardless of whether there is any content in pageIntroText field?</p>

<p>Any ideas?</p>

<p>Many thanks</p>

<p>Martin</p>

<conditional><children>
Remove the anchor in nav loop based on another field conditional
# Remove the anchor in nav loop based on another field conditional

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

I'm using this solution to output the children within a current structure entry.  Unfortunately I need to take out the anchor on some entries that don't yet have content, but still include the (unlinked) title.
I'm trying the following
{% nav page in subnav  %}
  {% if page.id != entry.id %}
  {% if page.pageIntroText|length %}{%endif%}{{ page.title }}{% if page.pageIntroText|length %}{%endif%}
  {%else%}
  {{ page.title }}{%endif%}
{% endnav %}

.. but it removes the anchor regardless of whether there is any content in pageIntroText field?
Any ideas?
Many thanks
username_0

**Tags:** conditional, children


---

## 1 answers

### Answer by username_1 on 2015-10-27. Score: 1

Instead of using `{% if page.pageIntroText|length %}` have you tried

`{% if page.pageIntroText is not empty %}`

> **Comments:**
> **username_0**: Thanks for your suggestion...  it didn't work.  I now have this:          {% nav page in subnav  %}           <li>             {% if page.pageIntroText is not empty %}               <a href="{{ page.url }}">{{ page.title }}</a>             {% else %}             {{ page.title }}             {% endif %}           </li>         {% endnav %}  
> **username_0**: Bizarre!  I've just tried using a different field for the conditional and it's worked fine???  
> **username_1**: What type of input is *pageIntroText*? I assumed it was Plain or Rich Text.  
> **username_0**: I'm an idiot! I have two fields, pageIntroText and practiceIntroText, this section is querying practiceIntroText.  Thanks for your help :/  

---

