flask-paginate icon indicating copy to clipboard operation
flask-paginate copied to clipboard

Missing rel attributes for links

Open DarkRedman opened this issue 1 year ago • 5 comments

I use flask_paginate 2022.01.08 with python 3.11

I think we could use (either by default or as an option) the rel attributes with prev and next to improve semantics and also use the prefetch attribute with next link, so it can accelerate the loading of next page when we click on the next link.

Here is the sample patch on version 2022.01.08 if I add the attributes next, prefetch for the next links.

53,54c53,54
< _bs = '<li class="next"><a href="{0}">{1}</a></li>'
< _bs33 = '<li><a href="{0}" aria-label="Next">\
---
> _bs = '<li class="next"><a href="{0}" rel="next prefetch">{1}</a></li>'
> _bs33 = '<li><a href="{0}" aria-label="Next" rel="next prefetch">\
57c57
< <a class="page-link" href="{0}" aria-label="Next">\
---
> <a class="page-link" href="{0}" aria-label="Next" rel="next prefetch">\
61c61
< <a class="page-link" href="{0}" aria-label="Next">\
---
> <a class="page-link" href="{0}" aria-label="Next" rel="next prefetch">\
63c63
< _bulma = '<a class="pagination-next" href={0} aria-label="Next">{1}</a>'
---
> _bulma = '<a class="pagination-next" href={0} aria-label="Next" rel="next prefetch">{1}</a>'

DarkRedman avatar Oct 10 '23 17:10 DarkRedman

This sounds like a good idea, maybe a prev_rel and next_rel parameter will be added to customize it. How is your think?

lixxu avatar Oct 12 '23 02:10 lixxu

I think it's a good idea, so I guess thoses would be boolean variables to activate/deactivate the feature ?

DarkRedman avatar Oct 23 '23 01:10 DarkRedman

may be not boolean, like this next_rel="next prefetch", and default is next_rel=""

lixxu avatar Oct 23 '23 01:10 lixxu

prefetch seems not available for <a ...>...</a> but for <link ....>...</link> https://www.w3schools.com/tags/att_a_rel.asp

lixxu avatar Oct 23 '23 02:10 lixxu

new version uploaded, you may try it.

lixxu avatar Oct 23 '23 03:10 lixxu