{"_id":"@ampernic/vitepress-plugin-breadcrumbs","name":"@ampernic/vitepress-plugin-breadcrumbs","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ampernic/vitepress-plugin-breadcrumbs","version":"0.1.0","description":"Dynamic VitePress-style breadcrumbs derived from the sidebar. Framework-agnostic, configurable, drop-in for any VitePress project.","license":"GPL-3.0-or-later","author":{"name":"Ampernic"},"repository":{"type":"git","url":"https://altlinux.space/ampernic/integrations.git","directory":"packages/vitepress-plugin-breadcrumbs"},"keywords":["vitepress","breadcrumbs","sidebar","navigation","vue"],"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./components/Breadcrumbs.vue":"./src/components/Breadcrumbs.vue"},"peerDependencies":{"vitepress":"^1.0.0","vue":"^3.0.0"},"peerDependenciesMeta":{"vue":{"optional":true}},"devDependencies":{"@types/node":"^22.0.0","builtin-modules":"^3.3.0","unbuild":"^2.0.0","vitepress":"^1.6.0"},"publishConfig":{"access":"public"},"scripts":{"build":"unbuild","stub":"unbuild --stub","dev":"unbuild --stub"},"_id":"@ampernic/vitepress-plugin-breadcrumbs@0.1.0","_integrity":"sha512-c85U7WYeEKaGQBULCv3v4VQ/MBsmaIdPl/xIl6wdAXa1QbbywYUbSHQVk6HHKkGwhtxME3aZl10M6Q0vgZp4zw==","_resolved":"/tmp/94b50501dcac1192b593a036ba94bc50/ampernic-vitepress-plugin-breadcrumbs-0.1.0.tgz","_from":"file:ampernic-vitepress-plugin-breadcrumbs-0.1.0.tgz","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-c85U7WYeEKaGQBULCv3v4VQ/MBsmaIdPl/xIl6wdAXa1QbbywYUbSHQVk6HHKkGwhtxME3aZl10M6Q0vgZp4zw==","shasum":"401428244a883273f321cb5be0bf4cace4fecc38","tarball":"https://registry.npmjs.org/@ampernic/vitepress-plugin-breadcrumbs/-/vitepress-plugin-breadcrumbs-0.1.0.tgz","fileCount":7,"unpackedSize":59320,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHcjSuVj35eDSmOXLZkO11aDIguhq6aSM/0t49B27ycCAiBl8IaFwWO7uEP8aRng1RwdgXO6gn/iKRDAzA1PDLPSSA=="}]},"_npmUser":{"name":"ampernic","email":"ampernic@inbox.ru"},"directories":{},"maintainers":[{"name":"ampernic","email":"ampernic@inbox.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vitepress-plugin-breadcrumbs_0.1.0_1779199427136_0.4689903886425748"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T14:03:47.027Z","0.1.0":"2026-05-19T14:03:47.291Z","modified":"2026-05-19T14:03:47.505Z"},"maintainers":[{"name":"ampernic","email":"ampernic@inbox.ru"}],"description":"Dynamic VitePress-style breadcrumbs derived from the sidebar. Framework-agnostic, configurable, drop-in for any VitePress project.","keywords":["vitepress","breadcrumbs","sidebar","navigation","vue"],"repository":{"type":"git","url":"https://altlinux.space/ampernic/integrations.git","directory":"packages/vitepress-plugin-breadcrumbs"},"author":{"name":"Ampernic"},"license":"GPL-3.0-or-later","readme":"# @ampernic/vitepress-plugin-breadcrumbs\n\nDynamic, VitePress-style breadcrumbs derived from the active page's\nposition in the **sidebar**. Framework-agnostic — no assumptions about\nyour content layout, usable in any VitePress project.\n\n## Install\n\n```sh\npnpm add @ampernic/vitepress-plugin-breadcrumbs\n```\n\n## Use\n\nAdd the component to a layout slot (commonly `doc-before`, above the page\ntitle):\n\n```ts\n// .vitepress/theme/index.ts\nimport DefaultTheme from 'vitepress/theme'\nimport { h } from 'vue'\nimport Breadcrumbs from '@ampernic/vitepress-plugin-breadcrumbs/components/Breadcrumbs.vue'\n\nexport default {\n  extends: DefaultTheme,\n  Layout: () =>\n    h(DefaultTheme.Layout, null, {\n      'doc-before': () => h(Breadcrumbs),\n    }),\n}\n```\n\n## Configure\n\nGlobally via `themeConfig.breadcrumbs`, or per-instance via props (props\nwin over config, config wins over defaults). Type the config with\n`defineBreadcrumbsConfig`:\n\n```ts\n// .vitepress/config.ts\nimport { defineBreadcrumbsConfig } from '@ampernic/vitepress-plugin-breadcrumbs'\n\nexport default {\n  themeConfig: {\n    breadcrumbs: defineBreadcrumbsConfig({\n      home: 'auto',\n      separator: '›',\n      hideSingle: true,\n      fallback: 'path',\n    }),\n  },\n}\n```\n\n| Option | Default | Description |\n|---|---|---|\n| `home` | `false` | Document-root crumb (links to the document landing/index). `false` = none; `{ text, link? }` = static (link defaults to the resolved landing); `'auto'` = link to the landing, text = `homeText` ?? site title ?? base slug; `(ctx) => ({ text, link? }) \\| false` = resolver built from [`BreadcrumbHomeCtx`](#resolver-context). On the index page itself it renders as the (non-link) current crumb. |\n| `homeText` | site title | Text for `home: 'auto'` |\n| `prefix` | `false` | Ancestor crumbs prepended *before* `home` (e.g. a cross-section site root and/or a distribution landing). `BreadcrumbHome[]` or `(ctx) => BreadcrumbHome[]`. Any prefix crumb whose link resolves to the current page becomes the current crumb; consecutive duplicate-link crumbs are merged. |\n| `showOnHome` | `false` | Also render on `layout: home` pages / when there is no document context, so a `prefix` can show breadcrumbs on the site root & landings |\n| `separator` | `'/'` | String between crumbs |\n| `showCurrentPage` | `true` | Append current page as last (non-link) crumb |\n| `hideSingle` | `true` | Render nothing when ≤ 1 crumb |\n| `fallback` | `'none'` | `'path'` derives crumbs from the URL when the page isn't in the sidebar; `'none'` renders nothing |\n| `class` | — | Extra class on the root `<nav>` |\n| `ariaLabel` | `'Breadcrumb'` | ARIA label for the landmark |\n\nDisable on a single page via frontmatter:\n\n```yaml\n---\nbreadcrumbs: false\n---\n```\n\n### Resolver context\n\n`home`/`prefix` functions receive a `BreadcrumbHomeCtx`:\n\n| Field | Description |\n|---|---|\n| `path` | Raw route path |\n| `segs` | Base-stripped path segments |\n| `base` | Site base (`'/'`, `'/alt-server/'`, …) |\n| `distro` | Base slug (`'alt-server'`); `''` when base is `'/'` |\n| `version` | First segment when it looks like a version (`1.2`, `1.2.3`, `p11`) |\n| `sidebarBase` | Resolved sidebar base (`'/11.1/'` or `''`) |\n| `landing` | Link to the document landing/index (site base + sidebar base) |\n| `siteTitle` | `themeConfig` site title |\n| `pageTitle` | Current page title |\n\nExample — a multi-level chain (site root → distribution landing →\ndocument index → sidebar trail → current page):\n\n```ts\nimport type { BreadcrumbHomeCtx } from '@ampernic/vitepress-plugin-breadcrumbs'\n\nbreadcrumbs: defineBreadcrumbsConfig({\n  showOnHome: true,\n  hideSingle: false,\n  home: (c: BreadcrumbHomeCtx) =>\n    c.distro ? { text: c.version ? `${c.distro} ${c.version}` : c.distro, link: c.landing } : false,\n  prefix: (c: BreadcrumbHomeCtx) => {\n    const arr = [{ text: 'Home', link: '/' }]\n    if (c.distro && c.version) arr.push({ text: c.distro, link: `/${c.distro}/` })\n    return arr\n  },\n})\n```\n\n## How it works\n\n1. The full ancestor chain is assembled as\n   `prefix → home → sidebar-ancestor groups`. Every entry carries a link.\n2. The current page is the last chain crumb whose link resolves to the\n   current route (so the document index/landing renders its own crumb as\n   *current*); otherwise the current page is appended explicitly.\n3. Consecutive crumbs pointing at the same page are de-duplicated.\n4. `hideSingle` then suppresses a lone crumb (e.g. a bare landing).\n\nThe sidebar trail is located inside `themeConfig.sidebar` (supports the\narray form, `SidebarMulti`, and `{ base, items }` groups), collecting the\nancestor group titles. If the page isn't found and `fallback: 'path'`,\ncrumbs are derived from the URL segments instead.\n\n## Styling\n\nScoped, uses VitePress CSS variables, and exposes stable classes you can\noverride: `.vp-breadcrumbs`, `.vp-breadcrumbs-list`,\n`.vp-breadcrumbs-item`, `.vp-breadcrumbs-link`, `.vp-breadcrumbs-current`,\n`.vp-breadcrumbs-sep`.\n\n## License\n\nGPL-3.0-or-later\n","readmeFilename":"README.md","_rev":"1-796fc74c83aee7842e911c85e57b51b8"}