For example, I have channel entry https://site.dev/news/2017/test and I would like to output "News" section name on entry page.


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 %}
    – curious
    Apr 27 '17 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 }}. Apr 27 '17 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
    Apr 29 '17 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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