-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Eleventy skips building paginated pages if the collection is empty. How do I build the page anyway? #1185
Comments
Huh, fascinating idea. Some ideas you could try: Make a separate If that doesn’t work you could try using Or you could add a Template Data file |
I think this is probably eligible for a feature request, just thinking more about it. Do you mind if I add this to the enhancement queue—even if you get it working using the ideas above? |
You're right, this most likely would get parsed as a string.
Hmm... this is a good idea. It's going to be a bit of an outlier because the rest of my front matter is YAML with Directory Data Files supplying the permalinks anyway. I'll just write the front matter in JS directly for this template. This is probably the best course of action for now. Thank you!
Yes please! I'm not a fan of keeping a bunch of extra templates (notes, photos, etc.) purely for this purpose so if at all this can be released as an enhancement, it would be amazing. It was surprising that this happened at all given how much control Eleventy gives to the developer (which is nice!), but holds back with a default behaviour here. |
Whoever does triaging, this is a duplicate of #731 |
Hi. Just want to add that, in my 2 cents' worth opinion, there is an everyday example where pagination should render the page even with empty data. I'm having a global data file, where I'm getting the category and all the products within that category with API. However, sometimes, there are temporarily no products within one of the categories. I guess this can be handled at the global data file, but I really think that this should be fixed as soon as possible. Cheers. |
I would also like to know if it is possible to display a page that receives an empty object in pagination. |
Note: there are some examples/workarounds in #2078 (reply in thread) discussion. |
Thank you @pdehaan for the suggested workarounds. I've managed to resolve this problem in |
I just did something similar to work around the issue. I posted an idea for an enhancement on the original bug #731 that doesn't look to overwhelming to implement and allows the developer to determine how they want to handle the custom message. |
I have a
notes.liquid
page with the following front-matter:The
notes
collection is empty. In this case, the page does not build. Navigating to/notes/
returns the following error in a browser:Removing pagination as follows:
...and then visiting the route works.
It seems Eleventy is not building the page is the collection is empty. Is it possible to change this behaviour? I'd like to display a small piece of paragraph instead of a paginated list on such a page, so I'd like for the page to still build.
The text was updated successfully, but these errors were encountered: