0

I have a section (structure) called "blog" but "blog" is not in the URL.

I have entries like:

Entry 1a
--Entry 1b
----Entry 1c
Entry 2a
---Entry 2b

A navigation like:

Overview <- a template in the root directory
Entry 1a
Entry 2a

I need to set "Overview" to active on all entries. Entry 1a should be active if itself or child's are shown. Entry 2a should be active if itself or child's are shown.

Doing this by hand for all entries would be a pain:

{% if craft.request.firstSegment == 'Entry 1a or Entry 1b' %}active{% endif %}
2
  • Have you tries using levels? something like {% if entry.level == 1 %}active{% endif %} – KSPR Aug 7 '19 at 12:34
  • @KSPR 1a and 2a or 1b and 2b are on the same level. So it wont work. – MrGlasspoole Aug 7 '19 at 15:43

Your Answer

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

Browse other questions tagged or ask your own question.