2

How can i redirect to the first child if an entry has children?

Something like this:

{% if entry.hasDescendants() %}
    {% redirect "{{ entry.getChildren().first().url }}" %}
{% endif %}
7

You have twig syntax ({{...}}) inside twig syntax ({%...%}), which is never right. Does this work?

{% if entry.hasDescendants() %}
  {% redirect entry.getChildren().first().url %}
{% endif %}
| improve this answer | |

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.