For example, I have channel entry https://site.dev/news/2017/test and I would like to output "News" section name on entry page.
1 Answer
Unless I'm misunderstanding, it should be as simple as:
{{ entry.section.name }}
-
Thanks. It was so simple. Do you have an idea how can I list section name also at section index page? Tried something like this but without effect
{% if craft.request.getSegment(2) is defined %}{{ entry.section.name }}{% else %}{{ title }}{% endif %}
– curiousCommented Apr 27, 2017 at 13:57 -
Depends if you have an entry associated with your index page, or just a template file? You might need something like
{{ craft.entries.section('slug').first().name }}
. Commented Apr 27, 2017 at 15:02 -
Hey, I just found a solution. It was just
{% if entry.section.name is defined %}{{ entry.section.name }}{% else %}{{ title }}{% endif %}
– curiousCommented Apr 29, 2017 at 11:00