Skip to content
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

Missing rel attributes for links #109

Open
DarkRedman opened this issue Oct 10, 2023 · 5 comments
Open

Missing rel attributes for links #109

DarkRedman opened this issue Oct 10, 2023 · 5 comments

Comments

@DarkRedman
Copy link

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>'
@lixxu
Copy link
Owner

lixxu commented Oct 12, 2023

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

@DarkRedman
Copy link
Author

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

@lixxu
Copy link
Owner

lixxu commented Oct 23, 2023

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

@lixxu
Copy link
Owner

lixxu commented Oct 23, 2023

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

@lixxu
Copy link
Owner

lixxu commented Oct 23, 2023

new version uploaded, you may try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants