` to be served at `/blog/` and `\u003CArticle />` to be served at inner routes\r\n3. Use custom layout component in `.vitepress/theme/index.js`\r\n```js\r\nexport default {\r\n ...DefaultTheme,\r\n Layout,\r\n};\r\n```\r\n3. Define routing logic in `Layout.vue` component\r\n```js\r\n\u003Ctemplate>\r\n \u003Cdiv>\r\n \u003CBlog v-if=\"isIndex\" />\r\n \u003CArticle v-else />\r\n \u003C/div>\r\n\u003C/template>\r\n\r\n\u003Cscript setup lang=\"ts\">\r\nimport { computed } from 'vue';\r\nimport { useRoute } from 'vitepress';\r\nimport Blog from './Blog.vue';\r\nimport Article from './Article.vue';\r\n\r\nconst route = useRoute();\r\nconst isIndex = computed(() => {\r\n return route.path.replace(/index.html$/, '') === '/';\r\n});\r\n\u003C/script>\r\n\r\n```\r\n\r\n### Expected behavior\r\n\r\nI expect that\r\n1. Blog component is served at `/blog/`\r\n2. Article component is served at `/blog/**/*` routes\r\n3. No `Hydration completed but contains mismatches.` error in the console\r\n4. No blinking screen that happens because the page is rendered as Article in SSR and then transformed into Blog during hydration\r\n\r\n### System Info\r\n\r\n```shell\r\nSystem:\r\n OS: macOS 11.6\r\n CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz\r\n Memory: 176.77 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node\r\n Yarn: 1.22.10 - /usr/local/bin/yarn\r\n npm: 7.17.0 - ~/.nvm/versions/node/v16.1.0/bin/npm\r\n Browsers:\r\n Brave Browser: 92.1.28.106\r\n Chrome: 96.0.4664.45\r\n Firefox: 90.0.2\r\n Safari: 15.0\r\n npmPackages:\r\n vitepress: ^0.20.1 => 0.20.1\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/coc)\r\n- [X] Read the [docs](https://vitepress.vuejs.org/).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[],446,"route.path doesn't work correctly with base option","2023-01-21T14:35:45Z","https://github.com/vuejs/vitepress/issues/446",0.7105447,{"description":2900,"labels":2901,"number":2905,"owner":2871,"repository":2872,"state":2886,"title":2906,"updated_at":2907,"url":2908,"score":2909},"### Describe the bug\r\n\r\nWhen using [`base`](https://vitepress.vuejs.org/config/basics.html#base), `route.path` is different across client and server.\r\n\r\nFor example, when using base `/base/` and logging `route.path`, `vitepress build` will log `/index.html`, but when visited in the browser, it logs `/base/index.html`.\r\n\r\n\r\n### Reproduction\r\n\r\n[Minimal reproduction link](https://github.com/privatenumber/issue-reproductions/tree/master/reproductions/vuejs/vitepress/587)\r\n\r\n1. Create a project with the following files:\r\n\r\n.vitepress/config.js\r\n```js\r\nimport { defineConfig } from 'vitepress'\r\n\r\nexport default defineConfig({\r\n\tbase: '/base/'\r\n})\r\n```\r\n\r\nindex.md:\r\n```html\r\n\u003Cscript setup>\r\nimport { useRoute } from 'vitepress';\r\n\r\nconst route = useRoute();\r\nconsole.log(`\\n\\nBUG: \"route.path\" is different across server and client: \"${route.path}\"\\n\\n`);\r\n\u003C/script>\r\n\r\nHello world\r\n```\r\n\r\n2. Run`vitepress build` and see `/index.html` get logged\r\n\r\n3. Run `vitepress serve` and see `/base/index.html` get logged\r\n\r\n\r\n### Expected behavior\r\n\r\nFor `route.path` to be consistent across server and client.\r\n\r\n### System Info\r\n\r\n```shell\r\nN/A\r\n```\r\n\r\n\r\n### Additional context\r\n\r\nRelated: https://github.com/vuejs/vitepress/issues/446\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\r\n- [X] Read the [docs](https://vitepress.vuejs.org).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2902],{"name":2903,"color":2904},"duplicate","cfd3d7",587,"base not used in route.path in server side","2023-01-21T16:04:13Z","https://github.com/vuejs/vitepress/issues/587",0.71427625,{"description":2911,"labels":2912,"number":2913,"owner":2871,"repository":2872,"state":2886,"title":2914,"updated_at":2915,"url":2916,"score":2917},"### Describe the bug\r\n\r\nI have the following site structure\r\n\r\n\r\n\r\n`/blog` is powered by VitePress (I set `base: '/blog/'` in `/blog/.vitepress/config.js`)\r\n\r\nThe problem is that links from `/blog` pages to other pages of the website do not work\r\n\r\n\r\n\r\nI checked the console and saw 404 for js bundles. And no document requests\r\n\r\n### Reproduction\r\n\r\nDescribed above\r\n\r\n### Expected behavior\r\n\r\nLinks to pages pages outside `/\u003CbasePath>/` should work.\r\n\r\nAs I understood, VitePress treats all the links under `/` as internal and applies routing and prefetching.\r\nThis is the root of the problem.\r\nScoping routing and prefetching to `/\u003CbasePath>/` should fix the problem.\r\n\r\nHere is where an additional check for `basePath` is needed for Router\r\nhttps://github.com/vuejs/vitepress/blob/main/src/client/app/router.ts#L125\r\n\r\n\r\nHere is where an additional check for `basePath` is needed for preFetch https://github.com/vuejs/vitepress/blob/main/src/client/app/composables/preFetch.ts#L83 \r\n\r\n\r\n\r\n\r\n### System Info\r\n\r\n```shell\r\nSystem:\r\n OS: macOS 11.6\r\n CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz\r\n Memory: 323.38 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node\r\n Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.0/bin/yarn\r\n npm: 8.1.4 - ~/.nvm/versions/node/v16.13.0/bin/npm\r\n Browsers:\r\n Brave Browser: 95.1.31.88\r\n Chrome: 96.0.4664.55\r\n Firefox: 90.0.2\r\n Safari: 15.1\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/coc)\r\n- [X] Read the [docs](https://vitepress.vuejs.org/).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[],458,"Links to pages outside \"base\" path scope do not work","2023-01-21T14:32:53Z","https://github.com/vuejs/vitepress/issues/458",0.7175813,{"description":2919,"labels":2920,"number":2921,"owner":2871,"repository":2872,"state":2886,"title":2922,"updated_at":2923,"url":2924,"score":2925},"### Describe the bug\r\n\r\nWe are using Vitepress to power a documentation and demo site for a UI library (https://doc.wikimedia.org/codex/main/), as an alternative to Storybook.\r\n\r\nRecently I created a new page to demonstrate a [tabbed layout component](https://772516--wikimedia-codex.netlify.app/components/tabs.html), which makes use of some internal links (with `@click.prevent` applied) for semantic/accessibility purposes. I was surprised to see that the demo page contained some unanticipated behavior – clicking a tab caused the page to jump around and updated the URL with a fragment ID.\r\n\r\nThis is happening because the Vitepress router [introduces a global event listener for all internal link elements on the page](https://github.com/vuejs/vitepress/blob/main/src/client/app/router.ts#L137-L174), adding some extra behavior (updating the URL hash, scrolling the target element into view). This makes sense for heading or section elements on the page, but it's being applied everywhere.\r\n\r\nIs there any way to scope this to be a little more specific? Maybe this handler should only apply to headings or section elements, or should only target elements that have been created by Vitepress as part of the page theme?\r\n\r\n### Reproduction\r\n\r\nBehavior can be seen here: https://772516--wikimedia-codex.netlify.app/components/tabs.html – click a tab in one of the demo components and watch the page jump around.\r\n\r\n### Expected behavior\r\n\r\nNot expecting additional behavior to be added to links inside embedded demo components on pages.\r\n\r\n### System Info\r\n\r\n```shell\r\nSystem:\r\n OS: macOS 12.3\r\n CPU: (10) arm64 Apple M1 Pro\r\n Memory: 141.38 MB / 16.00 GB\r\n Shell: 5.8 - /bin/zsh\r\n Binaries:\r\n Node: 16.14.0 - /opt/homebrew/opt/node@16/bin/node\r\n npm: 8.3.1 - /opt/homebrew/opt/node@16/bin/npm\r\n Browsers:\r\n Chrome: 99.0.4844.83\r\n Firefox: 98.0.1\r\n Safari: 15.4\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\r\n- [X] Read the [docs](https://vitepress.vuejs.org).\r\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[],591,"Router: event listener on internal links is overly broad","2023-01-21T14:26:46Z","https://github.com/vuejs/vitepress/issues/591",0.7210284,{"description":2927,"labels":2928,"number":2929,"owner":2871,"repository":2872,"state":2886,"title":2930,"updated_at":2907,"url":2931,"score":2932},"**Describe the bug**\r\nRoute links redirect to the correct route, but the content of the page is not rendered. Instead error is returned. In dev mode everything works as expected.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. add custom 404 component;\r\n2. add link to `index.md` in the component, like: `\u003Ca href=\"/\">index.md\u003C/a>`;\r\n3. run `vitepress build`;\r\n4. go to non-existing route and click on the link.\r\n\r\n**Expected behavior**\r\nThe page should be rendered.\r\n\r\n**System Info**\r\n- vitepress version: 0.11.5\r\n- vite version: 2.0.0-beta.64\r\n- Node version: v12.18.3\r\n- OS version: Pop!_OS 20.10\r\n\r\n**Additional context**\r\nThe error it is returning:\r\n\r\n\r\ncode: https://github.com/canicjusz/vitepress-route-bug\r\n",[],221,"Route links don't work in 404 component, in build mode","https://github.com/vuejs/vitepress/issues/221",0.72162116,{"description":2934,"labels":2935,"number":2939,"owner":2871,"repository":2872,"state":2886,"title":2940,"updated_at":2941,"url":2942,"score":2943},"**Describe the bug**\r\nThe Guide's [Configuration page] refers to [https://vitepress.vuejs.org/config/](https://vitepress.vuejs.org/config/) but that page gives a 404. \r\n\r\nThis should likely be `https://vitepress.vuejs.org/config/basics` which can be reached from the top navigation bar.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n- visit https://vitepress.vuejs.org/guide/configuration.html\r\n\r\n**Expected behavior**\r\n\r\nI would have done a PR but not sure, whether the URL without `basics` is expected to work (different from changing the URL itself by appending that string).\r\n\r\n**System Info**\r\n- vitepress version: online docs\r\n\r\n**Additional context**\r\n",[2936],{"name":2937,"color":2938},"docs","0075ca",160,"Config page has a missing link","2023-01-21T16:24:13Z","https://github.com/vuejs/vitepress/issues/160",0.72560817,{"description":2945,"labels":2946,"number":2948,"owner":2871,"repository":2872,"state":2886,"title":2949,"updated_at":2950,"url":2951,"score":2952},"### Describe the bug\n\nI have customized a component to display a summary of a post and bind it with a click event to navigate to the details page. However, I encountered an error on the line `const router = useRouter()` : \"useRouter() is called without provider.\" Can you please help me understand the reason behind this?\r\n\r\nThis's my code here:\r\n```vue\r\n\u003Cscript setup>\r\nimport { useRouter } from 'vitepress'\r\n\r\ndefineProps({\r\n posts: {\r\n type: Array,\r\n default: NaN,\r\n }\r\n})\r\n\r\nfunction toDetail(url) {\r\n const router = useRouter()\r\n // ...\r\n}\r\n\r\n\u003Ctemplate>\r\n\u003Cdiv>\r\n \u003Cdiv v-for=\"item of posts\" @click=\"toDetail(item.url)\" class=\"post-slider\" :key=\"item.frontmatter.id\" >\r\n \u003C!-- -->\r\n \u003C/div>\r\n\u003C/div>\r\n\u003C/template>\r\n```\r\n\r\nI found the definition of this method in the source code:\r\n```javascript\r\nexport function useRouter(): Router {\r\n const router = inject(RouterSymbol)\r\n if (!router) {\r\n throw new Error('useRouter() is called without provider.')\r\n }\r\n return router\r\n}\r\n```\r\nClearly, the router is not properly initialized, but I'm unsure of the further reason behind it.\n\n### Reproduction\n\nAs the description shows.\n\n### Expected behavior\n\nThe reason for the bug.\n\n### System Info\n\n```sh\nwindows11\n```\n\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.dev).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2947],{"name":2882,"color":2883},2391,"Bug: useRouter() is called without provider.","2023-05-28T00:04:36Z","https://github.com/vuejs/vitepress/issues/2391",0.728511,{"description":2954,"labels":2955,"number":2957,"owner":2871,"repository":2872,"state":2886,"title":2958,"updated_at":2959,"url":2960,"score":2961},"### Describe the bug\n\n```\r\nimport { useRouter } from 'vitepress';\r\nconst router = useRouter();\r\n\r\n```\r\nThis code used in \".vitepress\\theme\\index.js\" cause the following error: \"Uncaught Error: useRouter() is called without provider\". \n\n### Reproduction\n\nLiterally as described\n\n### Expected behavior\n\nTo be able to use the router to watch the route change\n\n### System Info\n\n```shell\nvitepress 1.0.0-alpha.47\n```\n\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.vuejs.org).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2956],{"name":2882,"color":2883},1992,"Uncaught Error: useRouter() is called without provider","2023-03-05T00:04:54Z","https://github.com/vuejs/vitepress/issues/1992",0.7292464,["Reactive",2963],{},["Set"],["ShallowReactive",2966],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fbThXSwMa62W18DzLSBDDL_xBOEUmu9HnsKWKTIq77c0":-1},"/vuejs/vitepress/813"]