2

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 1

5

Unless I'm misunderstanding, it should be as simple as:

{{ entry.section.name }}
3
  • 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 %}
    – curious
    Commented 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 %}
    – curious
    Commented Apr 29, 2017 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.