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

Context and collections: follow-up questions #41

Open
robinmetral opened this issue Aug 15, 2024 · 1 comment
Open

Context and collections: follow-up questions #41

robinmetral opened this issue Aug 15, 2024 · 1 comment

Comments

@robinmetral
Copy link
Owner

robinmetral commented Aug 15, 2024

Basic context and collections support were added in #34. There is clearly some room for iterations.

Some questions to get started:

  • Currently, context only includes pages that are in collections, under context.<collection>. Should it include all pages instead?
  • Currently, only pages with a published_date are allowed in collections. Should this change?
    • there is already a use case for this: the unnamed travel blog that uses brut has a regular posts collection, but it also has a dozen country pages that would benefit from being a collection, because they could be rendered on a countrIES page using a mustache section. (Currently the countries metadata is manually added to the context in processContext.)
    • published_date is how collection pages are sorted. How should they be sorted otherwise? Alphabetically? What if some pages in a collection have a published_date, and others do not?
  • 🚧 add more here 🚧
@robinmetral
Copy link
Owner Author

robinmetral commented Aug 16, 2024

Prior art

  • Jekyll collections don't need published_dates and the docs explicitly states that they can be used e.g. to iterate over a collection of staff members. Sorting is by date if present in all items, otherwise it falls back to an alphabetical sorting by slug. Custom sorting is also an option
    • I like that it's possible to have collections without dates. It makes sense for a lot of content, in this case staff member pages, but could also be country pages on an unnamed travel blog
  • Eleventy uses frontmatter tags to generate collections (and they can be declared in config for faster builds). Collection pages can be anywhere in the directory. They are sorted by date, and all content is dated (falls back on file created date, with a bunch of caveats). Custom sorting is also an option but Eleventy recommends using date to sort collections (?!). All content is also included in an automatic all collection, which can be used to loop through all pages.
    • I don't think it's necessary to allow pages to be located anywhere
    • I don't like the weird all-pages-are-dated thing, I'd prefer using the published_date or a custom sort, and fall back to the slug
    • I'm not sure exactly what the all collection is used for, might be interesting to look at use cases 👀
    • Generally I think tags will be something different in brut. They can technically already be used via processContext: loop through pages and group them by anything you want in frontmatter. These are kind of manual collections. brut collections would probably stick closer to the fs and group things that are colocated in a given directory

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

No branches or pull requests

1 participant