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 .HeadlessPages to site variable. #4882

Closed
regisphilibert opened this issue Jun 26, 2018 · 8 comments
Closed

Add .HeadlessPages to site variable. #4882

regisphilibert opened this issue Jun 26, 2018 · 8 comments

Comments

@regisphilibert
Copy link
Member

regisphilibert commented Jun 26, 2018

Because Headless pages are excluded from every page collections, there is currently no easy way to iterate over a set of headless pages.

Along the line of .Site.RegularPages and .Site.AllPages, would it be possible to create a new site variable (.Site.HeadlessPages) where all the Headless pages of one site would be stored and easily accessed (using where, sort etc...) by the users.

I think people will need to range on their headless pages eventually. I see a lot of use cases where they are used as data with a bundle… (sponsors, ads, team members) resulting in dozens of headless pages which, at some point in a template, need to be conveniently iterated over.

As of today, I don’t see any easy way. You have to know where to look in order to create a range on their filename and then use .GetPage on each of them inside the range like described here.

Also see this thread.

@budparr
Copy link

budparr commented Jun 26, 2018

This would truly solve the issue I raised last year, too. #3612

@bep
Copy link
Member

bep commented Jun 26, 2018

I don't think so. I think the people asking for this are asking for something else. As in, it would be a hack to solve #3612

@budparr
Copy link

budparr commented Jun 26, 2018

What would solve #3612? As it stands, I am still using the hack mentioned in that post.

@regisphilibert
Copy link
Member Author

regisphilibert commented Jun 26, 2018

I don't think so. I think the people asking for this are asking for something else.

They may want for a way to include both normal pages and headless pages in a call, but I Understand the absurdity of it (and don't want it), hence my suggestion of giving an access to headless pages only.

I have not used headless pages in any of my project yet, so I don't feel very opinionated about this issue yet, but by the look of it, people will have to hack their way around this restriction (using a lot of .GetPage) or eventually drop the use of Headless page bundles when needing to display more than one a page.

@openscript
Copy link
Contributor

We are using some workaround, because this feature is missing. We flag all headless files and remove them during the build process with a script. We had to add some stuff to the sitemap as well.

Currently we are not using the intended functionality of headless pages at all.

@stale
Copy link

stale bot commented Oct 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Oct 26, 2018
@stale stale bot closed this as completed Nov 25, 2018
@TonioGela
Copy link

+1

@github-actions
Copy link

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 18, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants