making next / previous buttons without pagination but with order declared in the navigation plugin #3037
Unanswered
phineas-pta
asked this question in
Show and tell
Replies: 1 comment 10 replies
-
I'd have to try recreating this locally (unless you have a public repo I can clone), but would it work if each book was it's own collection and then you try using |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all 👋 just want to show a snippet of code i created
so i have folder structure like this:
i rely totally on navigation plugin to make table of contents per subject then per book, also the breadcrumbs, so front matter for any subject - book - chapter must be:
then i want to implement next / previous buttons for each chapter but
getPreviousCollectionItem
/getNextCollectionItem
doesnt work witheleventyNavigation
😞if i understand correctly official docs:
pagination
field to front mattertags
field to front matterso like i have to repeat the order & parent title in front matter with those fields (pls correct me if im wrong)
my solution is to create a filter to get url of next / previous chapter
then i can do in a chapter (nunjucks template):
im open to hear any suggestion to improve this kind-of boilerplate code 😄
edit 1 simplify code a bit & change md to html
Beta Was this translation helpful? Give feedback.
All reactions