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

Make prev / next links changeable #1914

Closed
4 tasks done
MarkusKeck opened this issue Feb 9, 2023 · 2 comments · Fixed by #1972
Closed
4 tasks done

Make prev / next links changeable #1914

MarkusKeck opened this issue Feb 9, 2023 · 2 comments · Fixed by #1972
Labels
theme Related to the theme

Comments

@MarkusKeck
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

Currently it is only possible to customize the text of the links, but not the link itself, this is taken from the sidebar. However, if a page does not exist in the sidebar, no prev / next link can be set or modified.

The current behavior causes the vitepress application to crash if the page is not in the sidebar and you set a prev link via frontmatter, because there is no prev link whose text you can change. As next link always the first page of the sidebar is used.

I think it would be good if you could customize not only the text but also the link.

image

Describe the solution you'd like

Change the frontmatter options from

---
prev: 'Get Started | Markdown'
---

to

---
prev:
    text: 'Get Started | Markdown'
    link: '/gettingstarted/markdown'
---

Describe alternatives you've considered

No response

Additional context

// prev-next.d.ts
    prev: {
        text: any;
        link: string;
    };
    next: {
        text: any;
        link: string;
    };

Validations

@brc-dd
Copy link
Member

brc-dd commented Feb 9, 2023

PRs are welcome. Need to update this file: https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/composables/prev-next.ts

@brc-dd brc-dd added enhancement theme Related to the theme labels Feb 9, 2023
@MarkusKeck
Copy link
Collaborator Author

MarkusKeck commented Feb 10, 2023

@brc-dd Is it mandatory that the application is backward compatible? Should both variants be supported, or is the variant with nested parameters sufficient?

---
prev: Get Started | Markdown
---

---
prev:
    text: Get Started | Markdown
    link: /gettingstarted/markdown
---

MarkusKeck added a commit to MarkusKeck/vitepress that referenced this issue Feb 22, 2023
close vuejs#1914

BREAKING CHANGE: The 'prev' and `next` frontmatter options have been changed.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants