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

Generate collections / add pages to collections based on eleventyComputed.tags content #3633

Open
olets opened this issue Jan 24, 2025 · 1 comment

Comments

@olets
Copy link

olets commented Jan 24, 2025

Is your feature request related to a problem? Please describe.

Colletions are generated and pages are added to collections for tags added in the frontmatter tags field, but not for tags added with eleventyIncluded.

Here's a close-to-minimal 3.0.0 repro. Compare src/index.11ty.js to dist/index.html.

https://stackblitz.com/edit/eleventy-dynamic-collections?file=src%2Findex.11ty.js

Describe the solution you'd like

Take eleventyComputed.tags into account when collecting pages.

Describe alternatives you've considered

There might be some way to hack this with a plugin. Gather up the tags, export them, then loop over them in the Eleventy config and manually create new collections. Feels like it would be tricky to go back and add the appropriate pages to the collection. Maaaybe eleventy-plugin-pack11ty's auto-collection would is relevant https://github.com/search?q=repo%3Anhoizey%2Feleventy-plugin-pack11ty%20autocollections&type=code.

Would much prefer to support doing this from within one Eleventy data file.

Additional context

This is similar to the title of

but the request there is for dynamic tags added in the frontmatter tags field.

Possible one enhancement would cover both, but they feel different. Close this issue if I'm wrong to think they're separate!

//

This would get us closer to

Could parse the inputPath and add dynamic tags.

@monochromer
Copy link
Contributor

Taken from https://www.11ty.dev/docs/data-computed/:

Note

It is important to note that Computed Data is computed right before templates are rendered. Therefore Computed Data cannot be used to modify the special data properties used to configure templates (e.g. layout, pagination, tags etc.). These restrictions may be relaxed over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants