Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page.children() lists child-pages + module-pages if Page is modular #2112

Closed
pamtbaau opened this issue Jul 22, 2018 · 1 comment
Closed

Comments

@pamtbaau
Copy link
Contributor

Current behaviour:

When a page is of type modular, the method Page.children() also lists all invisible module-pages. Page.collection() on the other hand correctly lists only the module-pages and not child-pages.

Expected behaviour:

I would expect Page.children() to only list the child-pages (visible + invisible), excluding invisible module pages.

I could use 'Page.children.visible()', to exclude module-pages. But what if I want to list all child-pages, visible + invisible?

Suggestion:

  • If behaviour of 'Page.children()' is as expected, then maybe the documentation could make this more clear.
  • Add parameter 'excludeModules=false' to 'Page.children()' to only list visible + invisible child-pages.
@rhukster
Copy link
Member

These are really two different things. .children() is used to get all page children, which you can further filter by appending .visible() etc to the call.

.collection() is a method that takes the filters and options set in the page's frontmatter into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants