Comments (8)
I thought about it for a second when writing this originally but then got scared of the possibilities and didn't implement it haha. Would be curious to hear how you want to do it. The problem I saw was that it makes the single collection case more annoying to deal with? Maybe it can be behind a flag somehow.
from collections.
I'm not sure i understand how it makes a single collection more annoying to deal with? I mean, for the metalsmith-collections code of course, it's more annoying. From the UX perspective it's nearly identical for a user to add One Collection, or two (depending on the syntax).
Ie:
---
collection: foo
---
metal.use collections({
foo: {}
})
vs
---
collection: foo bar
---
metal.use collections({
foo: {},
bar: {}
})
The syntax doesn't really change for the user. Now, the YAML is obviously wrong there.. in the sense that it's not a list. I believe collection: [foo, bar]
would be the correct example. But even then, we could support [foo, bar]
and 'foo'
wouldn't be hard imo.
Perhaps (likely lol) i'm forgetting/missing something? I'm quite new to the project :)
from collections.
Ah, the one place where I see it gets more annoying is the .collection
property added to the files. I've been using that in templates so that each file can know which collection it's in. Would need to be an array I guess for multiples, which makes the single case a bit uglier sadly.
from collections.
Perhaps a different namespace? collection
and collections
.
I'm not sure what collection
would be, if there were many collections, but on the flipside collections
would always be one or more items, within a list.
This would be something each user opts into, per document, so in theory they're responsible for handling the change in output (imo) - but i agree consistency is always optimal
from collections.
Yeah I think if we keep it behind a multiple
flag that might work. And if multiple: false
then we just grab the first collection in the YAML array. That way the simple case is foremost, but multiple
can be achieved when needed. Multiple would add collections
and single would add collection
but never both.
from collections.
Sounds good, how would you like to see the multiple flag specified?
from collections.
Damn. I forgot this plugin just takes top-level collections. I guess we should change it to:
{
collections: { ... },
multiple: true
}
That would be kind of nice anyways, because it means we could have other top-level defaults across all collections like sortBy
which I've been duplicating for now.
from collections.
btw, @anthonyshort just added support for this: #19
from collections.
Related Issues (20)
- Roadmap 2.0 HOT 1
- Proposal: more declarative/condensed sort options
- Use metalsmith.match instead of multimatch
- Next/previous links not set HOT 2
- Update changelog HOT 1
- Absence of metadata in output in non-empty collections HOT 2
- Multiple builds break the plugin HOT 2
- Why is the property added collection and not collections? HOT 3
- Open to other maintainers? HOT 3
- data.path would be more useful with an html extension than a markdown one HOT 1
- storyblok and metalsmithJs (how to create a collection of blog-posts)
- Path not being set properly when using metalsmith-in-place HOT 5
- Metadata for documents contains markdown HOT 1
- Organizing posts into mutiple collections? HOT 1
- How to generate URLs using path variable? HOT 2
- please update npm repo HOT 4
- How to ungroup the grouped .hbs templates in .yaml file in metalsmith pattern collection HOT 4
- Transfer ownership to metalsmith org
- Feature: add 'first' and 'last' references
- Fix ambiguous mapping of metadata vs pattern collections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from collections.