If you want vuepress to redirect urls to any website here's how you do it 👇
I wanted to create short urls that links to my social media and other external websites.
✅ In enhanceApp.js
file add or insert the following snippet
export default ({ Vue, options, router }) => {
router.addRoutes([
{
path: '/facebook-group', // the url users will visit
beforeEnter(to, from, next) {
// you can add analysis or logging stuff here
// url user will be redirected to 👇
window.location.href = 'https://www.facebook.com/groups/laravel.arabic';
},
},
]);
}
⚠ Update addRoutes
is deprecated in vue router 4 use addRoute
instad 👇
export default ({ Vue, options, router }) => {
router.addRoute(
{
path: '/facebook-group', // the url users will visit
beforeEnter(to, from, next) {
// you can add analysis or logging stuff here
// url user will be redirected to 👇
window.location.href = 'https://www.facebook.com/groups/laravel.arabic';
},
},
]);
}