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

Include unrendered pages in sections, add render property to templates #2585

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

clarfonthey
Copy link
Contributor

@clarfonthey clarfonthey commented Jul 22, 2024

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Are you doing the PR on the next branch?
  • Have you created/updated the relevant documentation page(s)?

On my blog, I make use of pages which aren't rendered but included in a section to make templating a little easier. What feels like the best way to ensure this is done correctly on the upstream zola is to add these pages to sections, but explicitly allow accessing the render field from templates to filter them out (or, in my case, not show permalinks, since they would not be rendered).

This seems reasonable considering how drafts also can be detected in templates as well, when drafts are enabled.

I can't imagine this affecting many blogs, but I can go for an alternative approach otherwise.

Note that this only affects directly sections, and does not affect taxonomies. Taxonomies explicitly exclude unrendered pages, and will not even let unrendered pages add new terms.

@Keats
Copy link
Collaborator

Keats commented Jul 23, 2024

That would be a big breaking change I think, and things like the sitemap would start showing them afaik? Maybe taxonomies as well. Do they need to be mixed with the other pages?

@clarfonthey
Copy link
Contributor Author

Note that they'd only be included in taxonomies if they were explicitly added to them, and at least imho, it's kind of weird to add a page you explicitly don't want to render to a taxonomy instead of just using the extra data. Although I'll test to see if they're added to taxonomies anyway, since I believe it just affects sections.

At least on my site which is using the change, they still aren't included on the sitemap.

I'll look into adding a few tests that check how unrendered pages are added to various parts of the site; these would be nice anyway considering how afaik this feature remains largely untested in the code.

@clarfonthey
Copy link
Contributor Author

Current progress: updated the site test to add an explicit check that an unrendered page is not in the sitemap, and also added an extra test that they can be accessed via templates. Still need to test that they don't show up in taxonomies, though.

@clarfonthey
Copy link
Contributor Author

So, at least for now, I'm excluding taxonomies entirely. There may be a benefit to also including unrendered pages in taxonomies, but at least for now, they are explicitly excluded and there are tests for this.

* They can be accessed through templates directly and through sections
* Unrendered pages are not added to sitemaps
* Unrendered pages are not added to taxonomies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants