Use return value from permalink function when checking for pagination #4142
philiprenich
started this conversation in
Enhancement Queue
Replies: 2 comments
|
It's possible that v3's Preprocesser API may be the preferred way to now do drafts. I'm currently on v2 so setting permalink to false is the recommended way there, where my issue is. Might not be worth the patch to an old version? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I am writing a
eleventyComputedglobal data function that sets permalinks based on another piece of data from frontmatter. If a file hasdraft: truethen the permalink is set to false and the page is unpublished. However, this breaks pagination even if the permalink value is untouched because Pagination.js plugin won't manage the page numbers if there a permalink exists, regardless of value. Therefore, it's impossible to globally manipulate permalinks.Example code:
Describe the solution you'd like
I would like Pagination.js to check the return value of the computed permalink function, rather than just the existence of the permalink config key.
https://github.com/11ty/eleventy/blob/e06b57efc0409247a5155512d5c75dcb05dd9b1e/src/Plugins/Pagination.js#L276
A quick edit to my locally installed 11ty node module to that line shows this working, using
undefinedas the check:Describe alternatives you've considered
Unfortunately, I don't have enough context on how the pagination system works under the hood to try other alternatives or solutions. From my understanding of permalinks, the only way to get a page to not be published is to set permalink to false. If there is another way to do drafts that doesn't touch permalinks, I could consider that.
Additional context
Related issue: #3241
All reactions