-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Ensure that the base is used for previous and next links #139
Ensure that the base is used for previous and next links #139
Conversation
@@ -35,7 +36,8 @@ export default defineComponent({ | |||
return { | |||
hasLinks, | |||
prev, | |||
next | |||
next, | |||
withBase, |
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.
Another option would be to use withBase
in getFlatSidebarLinksFromArray
:
if (item.link) {
links.push({ text: item.text, link: withBase(item.link) })
}
However, that would also require using withBase
in currentPath
for the comparison in currentIndex
to work as expected.
Calling it in the component seemed consistent with how the logo is currently being rendered.
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.
Yeah, I would like to refactor the use of withBase
, but for now it's being used everywhere so I think this is fine!
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.
Thanks a lot! Totally missed this one 👀 Great work!
@@ -35,7 +36,8 @@ export default defineComponent({ | |||
return { | |||
hasLinks, | |||
prev, | |||
next | |||
next, | |||
withBase, |
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.
Yeah, I would like to refactor the use of withBase
, but for now it's being used everywhere so I think this is fine!
Description 📖
This pull request fixes next and previous links in sites with a non-default
base
configuration.Background 📜
#130 recently moved the previous and next page link calculation to the client side.
Because links used in the sidebar don't include the base, rendering them directly causes them to have an incorrect URL.