1

I want to build a subnav with all entries from the current Section.

{% set pages = craft.entries.section(getCurrentSection).level(1) %}

I'm looking for the handle "getCurrentSection". I will use this for pages in 5 different sections, so I don't want to select the section by hand, like:

{% set pages = craft.entries.section('Section 1').level(1) %}
{% set pages = craft.entries.section('Section 2').level(1) %}
......
2

You can get the current section handle from the entry like so

{{ entry.section.handle }}
1
  • No problems, glad it did the trick ;) – Fyrebase Aug 31 '16 at 14:29

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.