Skip to content

Commit

Permalink
add routes to internal pages
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed Dec 1, 2018
1 parent 18757ce commit fe5a8a3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
44 changes: 27 additions & 17 deletions docs/.vuepress/enhanceApp.js
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
}
})
}
4 changes: 2 additions & 2 deletions docs/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Query <span class="token punctuation">{</span>
<div class="w-full mb-4 md:w-1/3 md:mb-0 px-4">
<h4 class="text-purple-darkest text-xl mb-2">Schema First</h4>
<p class="mb-2">Lighthouse allows you to use the native Schema Definition Language to describe your data. Leverage server-side directives to add functionality and bring your schema to life.</p>
<a href="/docs/latest.html" @click.prevent="$router.push('/docs/latest.html')" class="font-bold uppercase text-sm">Read More</a>
<a href="/docs/latest/the-basics/schema.html" @click.prevent="$router.push('/docs/latest/the-basics/schema.html')" class="font-bold uppercase text-sm">Read More</a>
</div>
<div class="w-full mb-4 md:w-1/3 md:mb-0 px-4">
<h4 class="text-purple-darkest text-xl mb-2">Laravel Friendly</h4>
Expand All @@ -78,7 +78,7 @@ type Query <span class="token punctuation">{</span>
<div class="w-full md:w-1/3 md:mb-0 px-4">
<h4 class="text-purple-darkest text-xl mb-2">Optimized for Eloquent</h4>
<p class="mb-2">Eloquent is an extremely powerful ORM. Lighthouse leverages your current model relationships and creates optimized database queries.</p>
<a href="/docs/latest.html" @click.prevent="$router.push('/docs/latest.html')" class="font-bold uppercase text-sm">Read More</a>
<a href="/docs/latest/guides/relationships.html" @click.prevent="$router.push('/docs/latest/guides/relationships.html')" class="font-bold uppercase text-sm">Read More</a>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"vuepress-theme-lighthouse": "file:./packages/vuepress-theme-lighthouse"
},
"scripts": {
"start": "npm run docs:dev",
"docs:dev": "vuepress dev .",
"docs:version": "node -e 'require(\"./.vuepress/lib/versioning.js\").generate()'",
"docs:build": "vuepress build ."
Expand Down

0 comments on commit fe5a8a3

Please sign in to comment.