Suppose I have a structure Section with Entries like this:

  • Parent A
    • Child X
  • Parent B
  • Parent C
    • Child Y

How would I return this list of Entries?

[Parent A, Parent B, Parent C]

You can use the level() parameter (docs) on your query:

{% set entries = craft.entries()
    .all() %}
  • Thank you so much @Oli. I really appreciate your help. Thank you again.
    – sam
    Sep 16 at 6:30

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.