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.
This would truly solve the issue I raised last year, too. https://github.com/gohugoio/hugo/issues/3612
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
What would solve #3612? As it stands, I am still using the hack mentioned in that post.
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.
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.
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.
+1