1

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]

1 Answer 1

2

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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