51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
import BlogPost from '@/pages/BlogPost'
|
|
import blogPosts from '@/assets/blogPosts'
|
|
|
|
const blogRoutes = blogPosts.map(bPost => {
|
|
return {
|
|
path: '/blog/post/' + bPost.key,
|
|
component: BlogPost,
|
|
props: {
|
|
cmpnt: bPost.module.vue.component,
|
|
attrs: bPost.module.attributes,
|
|
},
|
|
}
|
|
})
|
|
|
|
import jobKeys from '@/assets/jobKeys'
|
|
|
|
const childJobRoutes = [
|
|
...jobKeys.map(jobKey => {
|
|
return {
|
|
path: jobKey,
|
|
component: require('@/job-posts/' + jobKey + '.md').vue.component,
|
|
}
|
|
}),
|
|
|
|
// Redirect `/job` to the `/jobs` page.
|
|
{ path: '', redirect: '/jobs' },
|
|
]
|
|
|
|
export default new VueRouter({
|
|
mode: 'history',
|
|
routes: [
|
|
{ path: '/', component: () => import('@/pages/Home') },
|
|
{ path: '/services', component: () => import('@/pages/Services') },
|
|
{ path: '/about', component: () => import('@/pages/About') },
|
|
{ path: '/blog', component: () => import('@/pages/Blog') },
|
|
...blogRoutes,
|
|
{ path: '/jobs', component: () => import('@/pages/Jobs') },
|
|
{ path: '/job', component: () => import('@/pages/JobPost'), children: childJobRoutes },
|
|
{ path: '*', component: () => import('@/pages/404.vue') }
|
|
],
|
|
|
|
scrollBehavior(to, from, savedPosition) {
|
|
return { x: 0, y: 0 }
|
|
},
|
|
})
|