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

Add recursive variants of .Pages and .RegularPages #6411

Closed
bep opened this issue Oct 10, 2019 · 6 comments · Fixed by #7058
Closed

Add recursive variants of .Pages and .RegularPages #6411

bep opened this issue Oct 10, 2019 · 6 comments · Fixed by #7058
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Oct 10, 2019

Currently when you do .Pages or .RegularPages, you the pages in the current section, one level deep.

But having a flat view of all the pages below a section (e.g. blog) is a common requirement, which in its simplest form isn't hard to do (most people do where .Site.RegularPages "Section" "blog" or something). But it gets non-trivial fast.

With the work I'm doing in this area, adding some simple-to-use methods for the above would be trivial.

The hard part is the naming, so please help.

Given the home page,

  • .PagesAll == .Site.Pages
  • .RegularPagesAll == .Site.RegularPages
  • $blog.RegularPagesAll will give all regular pages in and below /blog.

.RegularPagesAll is obviously not a good name, which is where I need some help.

/cc @regisphilibert @kaushalmodi

@bep bep added this to the v0.59 milestone Oct 10, 2019
@kaushalmodi
Copy link
Contributor

.RegularPagesRecursive? It's a bit wordier but there will be no confusion on what it does.

@kaushalmodi
Copy link
Contributor

But Recursive isn't a particularly common word, and even I'm not sure that it covers what it says.

Here are few common uses of "recurse" .. grep -r or grep --recursive, git clone --recurse-submodules ... I think it should be pretty evident; just my few cents.

@bep
Copy link
Member Author

bep commented Oct 10, 2019

Yes, it's pretty good, I'll admit that. And it's certainly shorter than the "where clause" needed today.

@regisphilibert
Copy link
Member

So even though it might not be 100% acurate to what we’re trying to achieve here what about .AllRegularPages

For me recursive is about function calling themselves but here we just want to a flat list of the tree’s leaves right?

There is slight possibility that this brings confusion with the existing site.AllPages which serves a different purpose (cross languages) but I’d take that risk.

@bep bep modified the milestones: v0.59, v0.60 Oct 21, 2019
@bep bep modified the milestones: v0.60, v0.61, v0.62 Nov 25, 2019
@bep bep modified the milestones: v0.62, v0.63 Dec 11, 2019
@bep bep modified the milestones: v0.63, v0.64 Jan 22, 2020
@bep bep modified the milestones: v0.64, v0.65 Jan 30, 2020
@bep bep modified the milestones: v0.65, v0.66 Feb 18, 2020
@andekande
Copy link

some more ideas:
.CurrentSection.PagesBelow
.CurrentSection.LeafPages
.CurrentSection.DescendantPages

In any case, would you then skip the Sub-Sections themselves from the result ? They can be accessed via the resulting Page anyway.

@bep bep modified the milestones: v0.66, v0.67 Mar 2, 2020
@bep bep modified the milestones: v0.67, v0.68 Mar 9, 2020
@bep bep self-assigned this Mar 16, 2020
bep added a commit to bep/hugo that referenced this issue Mar 16, 2020
@bep bep closed this as completed in #7058 Mar 16, 2020
bep added a commit that referenced this issue Mar 16, 2020
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants