-
Notifications
You must be signed in to change notification settings - Fork 66
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
Next/previous links not set #104
Comments
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". |
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)) |
I'm using collections for my site, which includes blogging, and I'm having one issue that I've tracked down the "why" (and I'll likely rewrite some of my code to make it do what I want), but it feels like I can't be the only one with the problem.
I have a collection "blog" in my build:
I also add tags using the collections frontmatter. The issue is that my posts don't know which collection they should have a next/prior in! If I only have the blog collection it works fine, and if they all have the same collections it also appears to be fine, but not if they have one or more collections that are not shared.
I'm not sure exactly how to solve it, either. Possibly a "primary" option, so that when it sets the previous/next fields, it picks the collection based on that?
The text was updated successfully, but these errors were encountered: