-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Explicit paging #216
base: master
Are you sure you want to change the base?
Explicit paging #216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing unit tests. If convenient, please add some test cases
lib/generator.js
Outdated
perPage, | ||
layout: ['archive', 'index'], | ||
format: paginationDir + '/%d/', | ||
explicitPaging: (config.archive_generator.explicit_paging || config.archive_generator.overwrite_latest || false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think overwrite_latest
should not be added here, as this may confuse users. It makes it ambiguous whether to enable explicit_paging
lib/generator.js
Outdated
|
||
if ((config.archive_generator.overwrite_latest || false) && pages.length > 0) { | ||
const lastPage = pages[pages.length - 1]; | ||
lastPage.path = lastPage.path.replace(/\/page\/\d+\/?$/, '/latest/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, this destroys the unambiguity of explicit_paging
.
I think adding an additional path will be better than overwriting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not modifying if there is a single page. The objective is to have it changed even if there is 1 page. For the users is transparent, it the flag is set then all the pages (even if there is only one) end with /latest in the path
for example /tag/mytag/1 is renamed to /tag/mytag/latest and properly linked if you create a page with all the tags.
the overwrite is made on purpose so that is not duplicating pages (the static generator create the page), as the last page (with number) is never used. You can see the result in my blog.
maybe moving |
moving it to hexo-pagination is an option so it can be done once for all the plugin. |
Co-authored-by: Uiolee <[email protected]> Signed-off-by: Marco Azimonti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the logic into hexo-pagination. If the implementation of hexo-pagination is fine and merged, then I can create a test case for this plugin also before the merge. Now I cannot create the fixture because hexo-pagination is not recognizing the new flag.
check list
Description
Adding a flag for
explicitPaging
introduced in the version 4.0.0 of hexo-pagination. hexojs/hexo-pagination#114Adding the option to have the last page to be
latest
which is convenient in case of reverse pagination.Additional information