Okay now I am able to change title and description, as well as meta data.
I found my REAL problem:
When I go on a route like /vision
, it always go first on the main index.html (/
route) before going to the /vision
route index.html. It’s like what… 0.2 seconds max loading.
Problem is that the same is happening when Google bot goes to /vision
, the result for him is /
route title and description instead of the good one.
Why do I have this problem ? Is it normal ?
Here is my router code:
const ROUTER_INSTANCE = new VueRouter({
mode: 'history',
routes: [
{
path: '/',
component: load('Layout/Navigation'),
meta: {
breadcrumb: 'Accueil',
name: '/'
},
children: [
{
path: '',
name: 'HomeComponentName',
component: load('Home/Home'),
meta: {
breadcrumb: 'Accueil',
title: 'Accueil | Alenvi'
}
// beforeEnter (toRoute, fromRoute, next) {
// window.document.title = PAGE_TITLE[toRoute.name];
// console.log(toRoute);
// next()
// }
},
{
path: 'vision',
name: 'VisionComponentName',
component: load('StaticPages/Vision'),
meta: {
breadcrumb: 'Vision',
name: 'vision',
title: 'Vision | Alenvi'
}
// beforeEnter (toRoute, fromRoute, next) {
// window.document.title = PAGE_TITLE[toRoute.name];
// console.log(toRoute);
// next()
// }
},
// ...
]
},
// Always leave this last one
{ path: '*', name: 'RouteErrorName', component: load('Error404') } // Not found
]
})
const PAGE_TITLE = {
HomeComponentName: 'Accueil | Alenvi',
VisionComponentName: 'Vision | Alenvi',
RouteErrorName: 'Erreur: Page non trouvée'
}
ROUTER_INSTANCE.beforeEach((to, from, next) => {
// window.document.title = PAGE_TITLE[toRoute.name]
document.title = to.meta.title
console.log(to);
next()
})
export default ROUTER_INSTANCE
It makes me sick, I don’t know what to do. Release is for tomorrow night, and I’m stuck on SEO… Really need help, someone ?