We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The plugin isn't idempotent, running it twice will screw up the metadata.
app = metalsmith() .use(collections({ articles: { ... } }) .build(done => ...) .build(done => ...)
The workaround is to create a middleware that clears up metadata:
app = metalsmith() .use((files, ms, done) => { ms.metadata({ articles: [] }) done() }) .use(collections({ articles: { ... } }) .build(done => ...) .build(done => ...)
The text was updated successfully, but these errors were encountered:
👍 On this.
I've spent some time on this issue. In my case (using collection: in frontmatter, collections gets populated automatically.
collection:
My solution is as follows:
app = metalsmith() .use((files, ms, done) => { const metadata = ms.metadata() const { collections } = metadata if (collections) { Object.keys(collections).forEach((k) => { metadata[k] = []; }); } done() }) .use(collections()) .build(done => ...) .build(done => ...)
Sorry, something went wrong.
Closing as this is a duplicate of #27
No branches or pull requests
The plugin isn't idempotent, running it twice will screw up the metadata.
The workaround is to create a middleware that clears up metadata:
The text was updated successfully, but these errors were encountered: