forked from nuwave/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
export default ({ | ||
Vue, // the version of Vue being used in the VuePress app | ||
options, // the options for the root Vue instance | ||
router, // the router instance for the app | ||
siteData // site metadata | ||
Vue, // the version of Vue being used in the VuePress app | ||
options, // the options for the root Vue instance | ||
router, // the router instance for the app | ||
siteData // site metadata | ||
}) => { | ||
|
||
// Redirect to latest docs | ||
router.addRoutes([ | ||
{ path: '/docs/latest.html', redirect: `/${siteData.themeConfig.versions.latest}/getting-started/installation.html` }, | ||
]) | ||
// Redirect to latest docs | ||
router.addRoutes([{ | ||
path: '/docs/latest.html', | ||
redirect: `/${siteData.themeConfig.versions.latest}/getting-started/installation.html` | ||
}, | ||
{ | ||
path: '/docs/latest/the-basics/schema.html', | ||
redirect: `/${siteData.themeConfig.versions.latest}/the-basics/schema.html` | ||
}, | ||
{ | ||
path: '/docs/latest/guides/relationships.html', | ||
redirect: `/${siteData.themeConfig.versions.latest}/guides/relationships.html` | ||
}, | ||
]) | ||
|
||
// Select docs version based on url path | ||
// Example: "/2.6/guides/installation.html" will use "2.6" | ||
router.afterEach((to, from) => { | ||
const version = to.path.split('/')[1] | ||
// Select docs version based on url path | ||
// Example: "/2.6/guides/installation.html" will use "2.6" | ||
router.afterEach((to, from) => { | ||
const version = to.path.split('/')[1] | ||
|
||
if (siteData.themeConfig.versions.all.includes(version)) { | ||
siteData.themeConfig.versions.selected = version | ||
} | ||
}) | ||
} | ||
if (siteData.themeConfig.versions.all.includes(version)) { | ||
siteData.themeConfig.versions.selected = version | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters