Rule in PAGINATION_PATTERNS
for custom last page location breaks category links for categories with few posts
#3307
Labels
Issue
When using
PAGINATION_PATTERNS
, one can provide rules to change the url/file location of the pages generated for pagination. It is possible to specify a rule for the first page and for the last page. If there is only one page in a particular pagination, that page will be both the first and the last. The logic will apply the rule for the last page in this case, which breaks category links.As an example, I have a category 'commentary' and have defined the following pagination settings:
There are only 4 articles in the 'commentary' category. The only file generated for the 'commentary' category is
output/category/commentarylast.html
.Now, when linking to the 'commentary' category from a template using the code from the built-in simple theme:
<a href="{{ SITEURL }}/{{ cat.url }}" {% if cat==category %} aria-current="page" ={% endif %}>{{ cat|lower}}</a>
a link will be generated to
category/commentary.html
, which does not exist.I think the solution is to change the rule selection logic, so that in case of only one page, the rule for first page is used instead of the rule for last page. I can make an MR for that, but only if you folks think that my issue actually is a bug and that my intended fix is indeed the way forward.
The text was updated successfully, but these errors were encountered: