Comments (2)
Hi there, this is a known issue that I have documented in bullet 3 in #100 and proposed solutions for (the problem is that all of them are breaking changes that require a major release). But I'll have a look if I can already guarantee that the first "attached" (=first in the array) collection of a file is considered "primary" for next/previous references. All you have to do then is make sure that you specify the collection which you desire next/previous refs for to be first declared in the YAML or added through a plugin.
Another issue is that "primary collection" is not absolute: suppose a category "front-end" page which lists all posts with that category, then "front-end" is the "primary" category in that context instead of "blog".
Ideally I'd add a test case with 5 files and a mix of collections to also ensure first/last references work
from collections.
Thank you! I had not noticed that roadmap, so wasn't sure if it was a "me" thing.
And yeah, I completely understand how much needs to be redone for that to work. In my code I only had that one "primary" category of "blog" (after deciding that I didn't want the taxonomy of categories-and-tags, and tags seemed to fit the way I was using that bit of the collections the best).
for anyone that has a similar usecase as me, I went with going through the blogs-collection and comparing the index, next and prior to the length of the collection (which leads to a second thing of "next/previous depends a on how one sorts" it. If it's sorted with "newest first", then the element of index 0 has no "next" but has a "previous", whereas if it's sorted with the oldest first it has a previous, but not a next (which doesn't need to be addressed in the plugin, to be clear, this is mainly me giving hints for anyone needing to juryrig it and some of the pitfalls I found))
from collections.
Related Issues (20)
- Roadmap 2.0 HOT 1
- Proposal: more declarative/condensed sort options
- Use metalsmith.match instead of multimatch
- 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.