Possible to have multiple collections point to same directory?

Is it possible to define multiple collections, but those collections pull their posts from the same directory?

My use case is, I’m creating a website that holds results of professional wrestling events. But there are different “types” of events: televisions shows, pay-per-view events, “house” shows (live, non-broadcast events), etc.

What I’d like to do is to just create all event posts in an _events directory, but then define multiple collections for each “type” of event that filters posts based on some criteria (say, category) and then has its own permalink structure.

Is this possible with Jekyll? I’m looking to do something like:

collections:
  ppv:
    directory: _events
    output: true
    permalink: /ppv/:series/:year
    where: "category == 'ppv'"
  tv:
    directory: _events
    output: true
    permalink: /tv/:series/:date
    where: "category == 'tv'"

Is this possible? Can I pull posts from a single directory into different collections based on some sort of conditional?

maybe just do it all in one collection and then use a front matter variable for the event type? like type: ppv.

So one collection called events, then use the type front matter to filter by that.

Not sure about the permalink structure, that may be a problem but I don’t use it much. I think if you used posts you could use category in the permalink so maybe the category would be the event type? outside of a post though I don’t think you can access the category in the permalink (not sure though) as category is special inside of posts but not so much else where.

1 Like