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

RFC Add Collections support. #368

Open
epage opened this issue Jan 22, 2018 · 9 comments
Open

RFC Add Collections support. #368

epage opened this issue Jan 22, 2018 · 9 comments
Labels
enhancement Improve the expected question Uncertainty is involved
Milestone

Comments

@epage
Copy link
Member

epage commented Jan 22, 2018

Use cases:

  • A site might track talks separately from blog posts (see johannhof's site).
  • A collection of quotes
  • Anything similar to a scrapbook

Proposal: support the user defining something like "posts" called a "collection".

User-facing design

Implementation

  • Collection struct
    • files function that returns a wrapper around Files that merges draft and non-draft results
    • Collection is given a ignore patterns for all other collections

Prior Art

Jekyll

See docs

@epage
Copy link
Member Author

epage commented Jan 22, 2018

Some ideas on refactoring to this:

This isn't about collections but more of notes on how I want to get there

Create Assets

  • SassOptions -> SassBuilder in a sass.rs file

Collection

  • Add option to Files to limit search to a specific sub-dir so we can walk each collection separately
  • PostBuilder is a specialized builder for CollectionBuilder

Work already done:

See also #312

@epage epage added the enhancement Improve the expected label Jan 22, 2018
@epage
Copy link
Member Author

epage commented Jan 22, 2018

See also #309 for alternative ideas for how to do rss for collections

@epage
Copy link
Member Author

epage commented Jan 22, 2018

One idea, spawned by #355, is for a folder to have a _collection.yml file. Anything in that folder or deeper would then be a part of that collection.

Pros

  • It keeps the configuration close by.
  • It makes it easy to detect the collection on a single file

Cons

  • More "turds" dropped in the user's site
  • We effectively have to walk the entire site (up until we find a _collection.yml) to discover all the collections
  • We can't walk each collection in parallel. Instead we walk the files and spit them out into each collection.

@epage epage added this to the 0.12 milestone Jan 22, 2018
@mnivoliez
Copy link

mnivoliez commented Jan 24, 2018

Why not making a conf file with all collections and folder for each one?
like

collections:
  - posts
  - talks

And in dir structure, we got folder posts (like usual) and talks.
What do you think?
Also, it's mean we can walk the collections in parallel more easely and not walk the entire directory structure.

@epage
Copy link
Member Author

epage commented Jan 24, 2018

My current is to have all of the collections defined in _cobalt.yml in a manner similar to posts.

collections:
- title: Cats
  rss: /cats.xml
  default:
    layout: cats.liquid

My comment above was more of a one off idea that I was exploring but probably won't do.

As mentioned above, the main question is how to handle RSS (see #309) but I think this should get implemented and worry about making RSS nicer, later.

@epage epage added the question Uncertainty is involved label Mar 19, 2018
@epage epage changed the title Add Collections support. RFC Add Collections support. Mar 19, 2018
@Geobert
Copy link
Contributor

Geobert commented May 9, 2018

We can mix both ideas, using epage format and the title as the folder name so we can walk collections in parallel. This whole collection concept looks like gutenberg's Section as well (a folder = a section)

@epage
Copy link
Member Author

epage commented May 9, 2018

Yeah, I've been looking at gutenburg and others when designing this. You can see the where I'm currently looking at going with collections by looking at the CollectionBuilder. We'd make a CollectionConfig similar to PostConfig and PageConfig that basically exposes every `CollectionBuilder feature in the config format.

@dmoles
Copy link

dmoles commented Aug 7, 2023

What's the status of this feature? The existence of collections.posts suggests the possibility of collections other than posts, but there doesn't seem to be any obvious way to create them (e.g. the syntax mentioned above produces Error: failed to parse config with unknown field `collections`​).

@epage
Copy link
Member Author

epage commented Aug 7, 2023

I have not gotten back to implementing this (which I need to)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected question Uncertainty is involved
Projects
None yet
Development

No branches or pull requests

4 participants