Skip to content

Commit 560fcd7

Browse files
committed
docs: use relative links
1 parent 0801dbb commit 560fcd7

24 files changed

+91
-109
lines changed

docs/.vitepress/config.js

-18
Original file line numberDiff line numberDiff line change
@@ -301,24 +301,6 @@ const config = {
301301
],
302302
},
303303
},
304-
305-
// '/es/': {
306-
// nav: [
307-
// {
308-
// text: 'Guía',
309-
// link: '/guide/',
310-
// },
311-
// {
312-
// text: 'API',
313-
// link: '/api/',
314-
// },
315-
// {
316-
// text: 'Cambios',
317-
// link:
318-
// 'https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md',
319-
// },
320-
// ],
321-
// },
322304
},
323305
}
324306

docs/api/index.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ If you add a `target="_blank"` to your `a` element, you must omit the `@click="n
154154

155155
When a `<router-view>` has a `name`, it will render the component with the corresponding name in the matched route record's `components` option.
156156

157-
- **See Also**: [Named Views](/guide/essentials/named-views.md)
157+
- **See Also**: [Named Views](../guide/essentials/named-views.md)
158158

159159
### route
160160

@@ -771,7 +771,7 @@ stringifyQuery?: (
771771
Route record that can be provided by the user when adding routes via the [`routes` option](#routeroptions) or via [`router.addRoutes()`](#addroutes). There are three different kind of route records:
772772

773773
- Single views records: have a `component` option
774-
- Multiple views records ([named views](/guide/essentials/named-views.md)): have a `components` option
774+
- Multiple views records ([named views](../guide/essentials/named-views.md)): have a `components` option
775775
- Redirect records: cannot have `component` or `components` option because a redirect record is never reached.
776776

777777
### path
@@ -782,7 +782,7 @@ Route record that can be provided by the user when adding routes via the [`route
782782
Path of the record. Should start with `/` unless the record is the child of another record.
783783
Can define parameters: `/users/:id` matches `/users/1` as well as `/users/posva`.
784784

785-
- **See Also**: [Dynamic Route Matching](/guide/essentials/dynamic-matching.md)
785+
- **See Also**: [Dynamic Route Matching](../guide/essentials/dynamic-matching.md)
786786

787787
### redirect
788788

@@ -801,7 +801,7 @@ Route record that can be provided by the user when adding routes via the [`route
801801

802802
Nested routes of the current record.
803803

804-
- **See Also**: [Nested Routes](/guide/essentials/nested-routes.md)
804+
- **See Also**: [Nested Routes](../guide/essentials/nested-routes.md)
805805

806806
### alias
807807

@@ -834,7 +834,7 @@ Route record that can be provided by the user when adding routes via the [`route
834834
Allows passing down params as props to the component rendered by `router-view`. When passed to a _multiple views record_, it should be an object with the same keys as `components` or a `boolean` to be applied to each component.
835835
target location.
836836

837-
- **See Also**: [Passing props to Route Components](/guide/essentials/passing-props.md)
837+
- **See Also**: [Passing props to Route Components](../guide/essentials/passing-props.md)
838838

839839
### meta
840840

@@ -843,7 +843,7 @@ Route record that can be provided by the user when adding routes via the [`route
843843

844844
Custom data attached to the record.
845845

846-
- **See Also**: [Meta fields](/guide/advanced/meta.md)
846+
- **See Also**: [Meta fields](../guide/advanced/meta.md)
847847

848848
## RouteRecordNormalized
849849

@@ -863,7 +863,7 @@ Normalized version of a [Route Record](#routerecordraw)
863863

864864
Navigation guard applied when entering this record from somewhere else.
865865

866-
- **See Also**: [Navigation guards](/guide/advanced/navigation-guards.md)
866+
- **See Also**: [Navigation guards](../guide/advanced/navigation-guards.md)
867867

868868
### children
869869

@@ -886,7 +886,7 @@ Normalized version of a [Route Record](#routerecordraw)
886886

887887
Arbitrary data attached to the record.
888888

889-
- **See also**: [Meta fields](/guide/advanced/meta.md)
889+
- **See also**: [Meta fields](../guide/advanced/meta.md)
890890

891891
### name
892892

@@ -918,7 +918,7 @@ Normalized version of a [Route Record](#routerecordraw)
918918

919919
## RouteLocationRaw
920920

921-
User-level route location that can be passed to `router.push()`, `redirect`, and returned in [Navigation Guards](/guide/advanced/navigation-guards.md).
921+
User-level route location that can be passed to `router.push()`, `redirect`, and returned in [Navigation Guards](../guide/advanced/navigation-guards.md).
922922

923923
A raw location can either be a `string` like `/users/posva#bio` or an object:
924924

@@ -988,7 +988,7 @@ Normalized route location. Does not have any [redirect records](#routerecordraw)
988988

989989
Arbitrary data attached to all matched records merged (non recursively) from parent to child.
990990

991-
- **See also**: [Meta fields](/guide/advanced/meta.md)
991+
- **See also**: [Meta fields](../guide/advanced/meta.md)
992992

993993
### name
994994

@@ -1041,7 +1041,7 @@ Normalized route location. Does not have any [redirect records](#routerecordraw)
10411041

10421042
Type of the navigation failure.
10431043

1044-
- **See Also**: [Navigation Failures](/guide/advanced/navigation-failures.md)
1044+
- **See Also**: [Navigation Failures](../guide/advanced/navigation-failures.md)
10451045

10461046
## NavigationGuard
10471047

@@ -1060,7 +1060,7 @@ Normalized route location. Does not have any [redirect records](#routerecordraw)
10601060
- [`RouteLocationRaw`](#routelocationraw): redirects to a different location
10611061
- `(vm: ComponentPublicInstance) => any` **only for `beforeRouteEnter`**: A callback to be executed once the navigation completes. Receives the route component instance as the parameter.
10621062

1063-
- **See Also**: [Navigation Guards](/guide/advanced/navigation-guards.md)
1063+
- **See Also**: [Navigation Guards](../guide/advanced/navigation-guards.md)
10641064

10651065
## Component Injections
10661066

@@ -1082,4 +1082,4 @@ These properties are injected into every child component by calling `app.use(rou
10821082
- **beforeRouteUpdate**
10831083
- **beforeRouteLeave**
10841084

1085-
See [In Component Guards](/guide/advanced/navigation-guards.md#in-component-guards).
1085+
See [In Component Guards](../guide/advanced/navigation-guards.md#in-component-guards).

docs/guide/advanced/composition-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Composition API guards can also be used in any component rendered by `<router-vi
8484

8585
## `useLink`
8686

87-
Vue Router exposes the internal behavior of RouterLink as a Composition API function. It gives access the same properties as the [`v-slot` API](/api/#router-link-s-v-slot):
87+
Vue Router exposes the internal behavior of RouterLink as a Composition API function. It gives access the same properties as the [`v-slot` API](../../api/#router-link-s-v-slot):
8888

8989
```js
9090
import { RouterLink, useLink } from 'vue-router'

docs/guide/advanced/dynamic-routing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dynamic Routing
22

3-
Adding routes to your router is usually done via the [`routes` option](/api/#routes) but in some situations, you might want to add or remove routes while the application is already running. Application with extensible interfaces like [Vue CLI UI](https://cli.vuejs.org/dev-guide/ui-api.html) can use this to make the application grow.
3+
Adding routes to your router is usually done via the [`routes` option](../../api/#routes) but in some situations, you might want to add or remove routes while the application is already running. Application with extensible interfaces like [Vue CLI UI](https://cli.vuejs.org/dev-guide/ui-api.html) can use this to make the application grow.
44

55
## Adding Routes
66

@@ -99,5 +99,5 @@ router.addRoute({
9999

100100
Vue Router gives you two functions to look at existing routes:
101101

102-
- [`router.hasRoute()`](/api/#hasroute): check if a route exists
103-
- [`router.getRoutes()`](/api/#getroutes): get an array with all the route records.
102+
- [`router.hasRoute()`](../../api/#hasroute): check if a route exists
103+
- [`router.getRoutes()`](../../api/#getroutes): get an array with all the route records.

docs/guide/advanced/navigation-guards.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Global before guards are called in creation order, whenever a navigation is trig
2020

2121
Every guard function receives two arguments:
2222

23-
- **`to`**: the target route location [in a normalized format](/api/#routelocationnormalized) being navigated to.
24-
- **`from`**: the current route location [in a normalized format](/api/#routelocationnormalized) being navigated away from.
23+
- **`to`**: the target route location [in a normalized format](../../api/#routelocationnormalized) being navigated to.
24+
- **`from`**: the current route location [in a normalized format](../../api/#routelocationnormalized) being navigated away from.
2525

2626
And can optionally return any of the following values:
2727

2828
- `false`: cancel the current navigation. If the browser URL was changed (either manually by the user or via back button), it will be reset to that of the `from` route.
29-
- A [Route Location](/api/#routelocationraw): Redirect to a different location by passing a route location as if you were calling [`router.push()`](/api/#push), which allows you to pass options like `replace: true` or `name: 'home'`. The current navigation is dropped and a new one is created with the same `from`.
29+
- A [Route Location](../../api/#routelocationraw): Redirect to a different location by passing a route location as if you were calling [`router.push()`](../../api/#push), which allows you to pass options like `replace: true` or `name: 'home'`. The current navigation is dropped and a new one is created with the same `from`.
3030

31-
It's also possible to throw an `Error` if an unexpected situation was met. This will also cancel the navigation and call any callback registered via [`router.onError()`](/api/#onerror).
31+
It's also possible to throw an `Error` if an unexpected situation was met. This will also cancel the navigation and call any callback registered via [`router.onError()`](../../api/#onerror).
3232

3333
If nothing, `undefined` or `true` is returned, **the navigation is validated**, and the next navigation guard is called.
3434

docs/guide/advanced/transitions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Transitions
22

3-
In order to use transitions on your route components and animate navigations, you need to use the [v-slot API](/api/#router-view-s-v-slot):
3+
In order to use transitions on your route components and animate navigations, you need to use the [v-slot API](../../api/#router-view-s-v-slot):
44

55
```html
66
<router-view v-slot="{ Component }">

docs/guide/essentials/dynamic-matching.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can have multiple _params_ in the same route, and they will map to correspon
3131
| /users/:username | /users/eduardo | `{ username: 'eduardo' }` |
3232
| /users/:username/posts/:postId | /users/eduardo/posts/123 | `{ username: 'eduardo', postId: '123' }` |
3333

34-
In addition to `$route.params`, the `$route` object also exposes other useful information such as `$route.query` (if there is a query in the URL), `$route.hash`, etc. You can check out the full details in the [API Reference](/api/#routelocationnormalized).
34+
In addition to `$route.params`, the `$route` object also exposes other useful information such as `$route.query` (if there is a query in the URL), `$route.hash`, etc. You can check out the full details in the [API Reference](../../api/#routelocationnormalized).
3535

3636
A working demo of this example can be found [here](https://codesandbox.io/s/route-params-vue-router-examples-mlb14?from-embed&initialpath=%2Fusers%2Feduardo%2Fposts%2F1).
3737

@@ -88,7 +88,7 @@ const routes = [
8888
]
8989
```
9090

91-
In this specific scenario we are using a [custom regexp](/guide/essentials/route-matching-syntax.md#custom-regexp-in-params) between parentheses and marking the `pathMatch` param as [optionally repeatable](/guide/essentials/route-matching-syntax.md#optional-parameters). This allows us to directly navigate to the route if we need to by splitting the `path` into an array:
91+
In this specific scenario we are using a [custom regexp](./route-matching-syntax.md#custom-regexp-in-params) between parentheses and marking the `pathMatch` param as [optionally repeatable](./route-matching-syntax.md#optional-parameters). This allows us to directly navigate to the route if we need to by splitting the `path` into an array:
9292

9393
```js
9494
this.$router.push({
@@ -101,7 +101,7 @@ this.$router.push({
101101
})
102102
```
103103

104-
See more in the [repeated params](/guide/essentials/route-matching-syntax.md#repeatable-params) section.
104+
See more in the [repeated params](./route-matching-syntax.md#repeatable-params) section.
105105

106106
If you are using [History mode](./history-mode.md), make sure to follow the instructions to correctly configure your server as well.
107107

docs/guide/essentials/history-mode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Not to worry: To fix the issue, all you need to do is add a simple catch-all fal
4242

4343
## Example Server Configurations
4444

45-
**Note**: The following examples assume you are serving your app from the root folder. If you deploy to a subfolder, you should use [the `publicPath` option of Vue CLI](https://cli.vuejs.org/config/#publicpath) and the related [`base` property of the router](/api/#createwebhistory). You also need to adjust the examples below to use the subfolder instead of the root folder (e.g. replacing `RewriteBase /` with `RewriteBase /name-of-your-subfolder/`).
45+
**Note**: The following examples assume you are serving your app from the root folder. If you deploy to a subfolder, you should use [the `publicPath` option of Vue CLI](https://cli.vuejs.org/config/#publicpath) and the related [`base` property of the router](../../api/#createwebhistory). You also need to adjust the examples below to use the subfolder instead of the root folder (e.g. replacing `RewriteBase /` with `RewriteBase /name-of-your-subfolder/`).
4646

4747
### Apache
4848

docs/guide/essentials/navigation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ router.push({ path: '/user', params: { username } }) // -> /user
5353

5454
Since the prop `to` accepts the same kind of object as `router.push`, the exact same rules apply to both of them.
5555

56-
`router.push` and all the other navigation methods return a _Promise_ that allows us to wait til the navigation is finished and to know if it succeeded or failed. We will talk more about that in [Navigation Handling](../advanced/navigation-handling.md).
56+
`router.push` and all the other navigation methods return a _Promise_ that allows us to wait til the navigation is finished and to know if it succeeded or failed. We will talk more about that in [Navigation Handling](../advanced/navigation-failures.md).
5757

5858
## Replace current location
5959

@@ -98,4 +98,4 @@ You may have noticed that `router.push`, `router.replace` and `router.go` are co
9898

9999
Therefore, if you are already familiar with [Browser History APIs](https://developer.mozilla.org/en-US/docs/Web/API/History_API), manipulating history will feel familiar when using Vue Router.
100100

101-
It is worth mentioning that Vue Router navigation methods (`push`, `replace`, `go`) work consistently no matter the kind of [`history` option](/api/#history) is passed when creating the router instance.
101+
It is worth mentioning that Vue Router navigation methods (`push`, `replace`, `go`) work consistently no matter the kind of [`history` option](../../api/#history) is passed when creating the router instance.

docs/guide/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ export default {
9090
}
9191
```
9292

93-
To access the router or the route inside the `setup` function, call the `useRouter` or `useRoute` functions. We will learn more about this in [the Composition API](/guide/advanced/composition-api.md#accessing-the-router-and-current-route-inside-setup)
93+
To access the router or the route inside the `setup` function, call the `useRouter` or `useRoute` functions. We will learn more about this in [the Composition API](./advanced/composition-api.md#accessing-the-router-and-current-route-inside-setup)
9494

9595
Throughout the docs, we will often use the `router` instance. Keep in mind that `this.$router` is exactly the same as directly using the `router` instance created through `createRouter`. The reason we use `this.$router` is because we don't want to import the router in every single component that needs to manipulate routing.

docs/guide/migration/index.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ app.config.globalProperties.append = (path, pathToAppend) =>
163163

164164
### Removal of `event` and `tag` props in `<router-link>`
165165

166-
Both `event`, and `tag` props have been removed from `<router-link>`. You can use the [`v-slot` API](/api/#router-link-s-v-slot) to fully customize `<router-link>`:
166+
Both `event`, and `tag` props have been removed from `<router-link>`. You can use the [`v-slot` API](../../api/#router-link-s-v-slot) to fully customize `<router-link>`:
167167

168168
```html
169169
replace
@@ -193,7 +193,7 @@ At the moment navigation guards in mixins are not supported. You can track its s
193193

194194
### Removal of `router.match` and changes to `router.resolve`
195195

196-
Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](/api/#resolve) for more details.
196+
Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](../../api/#resolve) for more details.
197197

198198
**Reason**: Uniting multiple methods that were used for the same purpose.
199199

@@ -354,7 +354,11 @@ const routes = [
354354
component: DashboardParent,
355355
children: [
356356
{ path: '', name: 'dashboard', component: DashboardDefault },
357-
{ path: 'settings', name: 'dashboard-settings', component: DashboardSettings },
357+
{
358+
path: 'settings',
359+
name: 'dashboard-settings',
360+
component: DashboardSettings,
361+
},
358362
],
359363
},
360364
]
@@ -384,7 +388,7 @@ const routes = [
384388

385389
Note this will work if `path` was `/parent/` as the relative location `home` to `/parent/` is indeed `/parent/home` but the relative location of `home` to `/parent` is `/home`.
386390

387-
<!-- Learn more about relative links [in the cookbook](/cookbook/relative-links.md). -->
391+
<!-- Learn more about relative links [in the cookbook](../../cookbook/relative-links.md). -->
388392

389393
**Reason**: This is to make trailing slash behavior consistent: by default all routes allow a trailing slash. It can be disabled by using the `strict` option and manually appending (or not) a slash to the routes.
390394

@@ -394,10 +398,10 @@ Note this will work if `path` was `/parent/` as the relative location `home` to
394398

395399
Decoded values in `params`, `query`, and `hash` are now consistent no matter where the navigation is initiated (older browsers will still produce unencoded `path` and `fullPath`). The initial navigation should yield the same results as in-app navigations.
396400

397-
Given any [normalized route location](/api/#routelocationnormalized):
401+
Given any [normalized route location](../../api/#routelocationnormalized):
398402

399403
- Values in `path`, `fullPath` are not decoded anymore. They will appear as provided by the browser (most browsers provide them encoded). e.g. directly writing on the address bar `https://example.com/hello world` will yield the encoded version: `https://example.com/hello%20world` and both `path` and `fullPath` will be `/hello%20world`.
400-
- `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })` and be used directly in [scrollBehavior](/api/#scrollbehavior)'s `el` option.
404+
- `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })` and be used directly in [scrollBehavior](../../api/#scrollbehavior)'s `el` option.
401405
- When using `push`, `resolve`, and `replace` and providing a `string` location or a `path` property in an object, **it must be encoded** (like in the previous version). On the other hand, `params`, `query` and `hash` must be provided in its unencoded version.
402406
- The slash character (`/`) is now properly decoded inside `params` while still producing an encoded version on the URL: `%2F`.
403407

@@ -417,6 +421,6 @@ To make typings more consistent and expressive, some types have been renamed:
417421

418422
Some of new features to keep an eye on in Vue Router 4 include:
419423

420-
- [Dynamic Routing](/api/#addroute-2)
421-
- [Composition API](/guide/advanced/composition-api.md)
424+
- [Dynamic Routing](../../api/#addroute-2)
425+
- [Composition API](../advanced/composition-api.md)
422426
<!-- - Custom History implementation -->

docs/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Vue Router is the official router for [Vue.js](http://v3.vuejs.org). It deeply i
1313
- Customizable Scroll Behavior
1414
- Proper encoding for URLs
1515

16-
[Get started](/guide/) or play with the [playground](https://github.com/vuejs/vue-router-next/tree/master/playground) (see [`README.md`](https://github.com/vuejs/vue-router-next) to run them).
16+
[Get started](./guide/) or play with the [playground](https://github.com/vuejs/vue-router-next/tree/master/playground) (see [`README.md`](https://github.com/vuejs/vue-router-next) to run them).
1717

1818
<HomeSponsors />
1919

0 commit comments

Comments
 (0)