-
Notifications
You must be signed in to change notification settings - Fork 101
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
Proof of concept: Collections support #88
base: master
Are you sure you want to change the base?
Proof of concept: Collections support #88
Conversation
Going by the initial CI tests, looks like more code forking might be needed to provide compatibility with Jekyll 2.0. 🤔 |
Thanks for the PR! Just some of my thoughts here:
|
Thanks for the feedback @alfredxing!
Makes sense. How would you imagine configuring collections? Perhaps:
How might we deal with the posts collection in this case? Enabled by default, but if adding a
Documents may not have these attributes by default, but they can – so this shouldn’t matter, no? (Most of my collection documents have dates, FWIW).
I had a feeling you might say this! Will look at the core and see if anything has been proposed already. My general sense is that the core still treats posts as a special case, when really they should be treated as a default; i.e. site.tags only looks at posts, when it should probably look across all documents. Anyway, I’ll move this particular discussion to core.
You’re overestimate my programming abilities!! But yes, I think this might need abstracting out. I’m curious as to the general approach regarding compatibility with plugins, though? |
@alfredxing Okay, I’ve had a stab at adding a global utility function to core ( |
Has there been any development on this pr? |
I know @spencertweedy already asked this question, but I wanted to reach out and ask if we might see this great initiative come to fruition. I'd be happy to make a donation if that helps! |
Hi all. I realized that the project has not been updated for a year, and the PR is from 2017, so I took the liberty to fork it and rebase the PR to 2.2.1 version. It seems to work for me. To use it, I put this into Gemfile:
|
I'll comment only to trigger some movement on this PR and show that there is someone who cares - thank you for the fork! |
What is this?
As it stands, this plugin only supports posts, i.e. documents in the default
posts
collection. Now that collections are mature and very useful, this plugin ought to support this Jekyll feature fully. This is my attempt at achieving this. Right now, it works, but it needs input and plenty of expert review.How do I propose enabling collection archives?
To ensure backwards compatibility, documents in the default
site.posts
collection will continue to appear within enabled archives, but to add additional collections, you’ll need to add anarchive: true
value to each collection’s respective config, e.g.:Is this the right approach? I also considered enabling archives via front matter defaults (and that way you could also exclude individual pages from being archived) but this felt like a separate feature.
Code review
Arguably, some of the code I’ve added here should be provided by Jekyll’s core. For example, Jekyll’s
post_attr_hash
utility only parses posts, but there doesn’t seem to be an equivalent function to parse documents across all collections; I’ve added adoc_attr_hash
utility to perform that function here. Or have I missed something? It should be noted that the code within this function feels fragile even to my inexperienced eyes, so I welcome improvements, optimisations and refinement.Next steps
I look forward to receiving feedback from the core plugin team, reviewers and others. /cc @alfredxing, @parkr, @pathawks