-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Prev/Next link text in sidebar config #1373
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
Comments
@brc-dd |
Yeah sorry about that. I hadn't read it properly. But currently we don't have any mechanism to access page data (including frontmatter) of a different (previous/next) page. Stuff might get complex while adding this functionality. Also, I don't think there will be a huge number of such pages where you'll need to customize that. I understand that it won't be best DX to keep track of these things, but IG current solution is usable. |
Yes, I thought the same about adding frontmatter to the destination page. But what about adding to config.js sidebar object? I don't know how it works, but if right now it is using the config.js to guess the sidebar, it should not be that difficult to add the text in the destination, since right now the building process is reading the title text of the destination to do it. It should be as simple as get other property (nextPrevText in my example) if present instead of the title property, isn't it? |
Yeah using sidebar config it can be done IG. This most likely will be used only when context (sidebar group) is changed. So we can probably introduce some property there and modify our composable. |
Is your feature request related to a problem? Please describe.
When the next/prev link text is generated, it takes the text from the frontmatter of the current page you are seeing. If empty, the text will be inferred from the sidebar config.
When inferred from sidebar, sometimes is weird. For example, in the vitepress api docs the "Next" text is "Introduction", and for me it should be "Themes - Introduction" (what if I have 3 sections with the introduction title?).
When using frontmatter, I can change the text in the guide/api page, but this means that if I add new documentation after the api page, the next text in the api page will be wrong.
Problem: In my opinion, the Next/Prev link should be defined in the same page (in this example, in the themes/introduction page), or in the same line as a new option in config.js for the themes/introduction page.
Describe the solution you'd like
Add nextPrevText property in sidebar items in
config.js
file, as follows:and change the priority of rendering the NextPrev text to the following:
Describe alternatives you've considered
Add nextPrevText in the frontmatter of the page I am going to go.
Additional context
https://vitepress.vuejs.org/guide/api
Validations
The text was updated successfully, but these errors were encountered: