Pagination: Add page.url.first, page.url.last to the Page interface #862
Closed
regisphilibert
started this conversation in
Proposal
Replies: 2 comments 1 reply
-
|
Sounds like a good idea to me! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hi. I opened a PR for this. withastro/astro#11176 |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
Summary
Adding two new keys to the
page.urlobject of the pagination's Page interface.page.url.firstwould return the url of the first page.page.url.lastwould return the url of the last page.Background & Motivation
Currently when building your own navigation, one must determine what is the first page url in order to build the list of links pointing to various pages. This url can be
/post/or/post/category/art/or/post/category/art/1etc...This determination can only be worked from
page.url.currentand involves several checks and conditions so that the proper "first page url" is retrieved and validated. For example this is currently what I need to do in order to build basicfirstUrlandlastUrl.There might be a simpler alternative which I missed out, but I believe this illustrates the time and efforts that this RFP could save for users.
Goals
Example
This would greatly simplify the building of any pagination links. Compare the following with the code shared above.
I feel like the naming of the keys follow the convention in use but any suggestion is welcome.
Beta Was this translation helpful? Give feedback.
All reactions