DEV Community

Discussion on: A simple way to keep your Vue page title in sync with the router

Collapse
 
psnehanshu profile image
Snehanshu Phukon

Another way is using router.afterEach

router.afterEach((to, from) => {
  if (to.meta && to.meta.title) {
    document.title = to.meta.title + ' | Any suffix';
  }
});
Enter fullscreen mode Exit fullscreen mode