-
-
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
breadcrumb #3534
Comments
You can use one of our layouts slots to add a breadcrumbs component there. |
this is temporary solve. I dont want to custom component |
This comment was marked as spam.
This comment was marked as spam.
That would be cool! Do we have any examples of that?
|
@peterbe Do your markdown files have some data in frontmatter that can tell their breadcrumb path? Asking because the final part of breadcrumb can be inferred from title, but not the other parts. Otherwise you'll need to maintain a list of data yourself 👀 Regarding layout slots, they are added via theme - https://vitepress.dev/guide/extending-default-theme#layout-slots - you can use doc-top/doc-before probably. |
It does not know about where it lives. All an individual file knows is that it's parent directory is called I'm trying to learn about https://vitepress.dev/guide/data-loading#createcontentloader and how it could make it possible to retroactive attach these. Still new to this :) |
If you can maintain an object like this: const names = {
'my-cool-directory': 'My Cool Dir',
...
} You can use https://vitepress.dev/reference/site-config#transformpagedata to do something like this: // .vitepress/config.ts
export default defineConfig({
transformPageData(pageData) {
pageData.frontmatter.breadcrumbs = [...pageData.relativePath.split('/').slice(0, -1).map(x => names[x]), pageData.title]
}
}) And then use this data in your vue component: |
Is your feature request related to a problem? Please describe.
nope
Describe the solution you'd like
I want to breadcrumb like this.
Describe alternatives you've considered
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: