<p>I think I might have found a solution, although it might not be very elegant :/</p>

<p>So, i'm basically looking to see if a category field has content and then taking out the anchor in the template.</p>

<pre><code>{% if category.practiceIntroText|length %}
    &lt;a href="{{ category.url }}"&gt;
{% endif %}
{{ category.title }}
{% if category.practiceIntroText|length %}
    &lt;/a&gt;
{% endif %}
</code></pre>

<p>Same code but making use of the ternary operator:</p>

<pre><code>{% set catWithContent = category.practiceIntroText|length %}

{{ catWithContent ? '&lt;a href="' ~ category.url ~ '"&gt;' }}
{{ category.title }}
{{ catWithContent ? '&lt;/a&gt;' }}
</code></pre>

CC BY-SA 3.0
2015-09-04T12:32:49.443Z
I think this is a good solution. Added a code variant that makes use of the ternary operator.
carlcs
CC BY-SA 3.0
2015-09-04T11:15:55.367Z
2015-09-04T12:31:26.637Z
2015-09-04T12:31:26.637Z
Martin
<p>So my client has thrown a curve ball!  I've set-up a list of categories for the types of work they cover.  However, they DON'T want all of the categories to actually link to an entry.  In other words, they don't have content for some of the category pages, they would still like to SHOW the category on the front end but not have it clickable.</p>

<p>So, some category links are clickable, others not :/</p>

<p>Any ideas?</p>

<p>Thanks</p>

<p>Martin</p>

<categories>
Have some categories NOT linked to a category entry
# Have some categories NOT linked to a category entry

(Asked by: username_0 on 2015-09-04)

So my client has thrown a curve ball! I've set-up a list of categories for the types of work they cover. However, they DON'T want all of the categories to actually link to an entry. In other words, they don't have content for some of the category pages, they would still like to SHOW the category on the front end but not have it clickable.

So, some category links are clickable, others not :/

Any ideas?

Thanks

Martin

**Tags:** categories

---

## 1 answers

### Answer by username_0 on 2015-09-04. Score: 2

I think I might have found a solution, although it might not be very elegant :/
So, i'm basically looking to see if a category field has content and then taking out the anchor in the template.
{% if category.practiceIntroText|length %}
    
{% endif %}
{{ category.title }}
{% if category.practiceIntroText|length %}
    
{% endif %}

Same code but making use of the ternary operator:
{% set catWithContent = category.practiceIntroText|length %}

{{ catWithContent ? '' }}
{{ category.title }}
{{ catWithContent ? '' }}

> **Comments:**
> **username_1**: I think this is a good solution. Added a code variant that makes use of the ternary operator.  

---

