79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
import store from '../store';
|
|
import HomeView from '../views/HomeView.vue';
|
|
import authRoutes from './authRoutes';
|
|
import socialRoutes from './socialRoutes';
|
|
import settingsRoutes from './settingsRoutes';
|
|
import adminRoutes from './adminRoutes';
|
|
import falukantRoutes from './falukantRoutes';
|
|
import blogRoutes from './blogRoutes';
|
|
import minigamesRoutes from './minigamesRoutes';
|
|
import personalRoutes from './personalRoutes';
|
|
import marketingRoutes from './marketingRoutes';
|
|
import { applyRouteSeo } from '../utils/seo';
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'Home',
|
|
component: HomeView,
|
|
meta: {
|
|
seo: {
|
|
title: 'YourPart - Community, Chat, Forum, Blogs, Vokabeltrainer und Spiele',
|
|
description: 'YourPart ist eine Community-Plattform mit Chat, Forum, Blogs, Vokabeltrainer, dem Browser-Aufbauspiel Falukant und Minispielen.',
|
|
keywords: 'YourPart, Community, Chat, Forum, Blogs, Vokabeltrainer, Browsergame, Falukant, Minispiele',
|
|
canonicalPath: '/',
|
|
jsonLd: [
|
|
{
|
|
'@context': 'https://schema.org',
|
|
'@type': 'WebSite',
|
|
name: 'YourPart',
|
|
url: 'https://www.your-part.de/',
|
|
inLanguage: 'de',
|
|
description: 'Community-Plattform mit Chat, Forum, Blogs, Vokabeltrainer, Falukant und Browser-Minispielen.',
|
|
potentialAction: {
|
|
'@type': 'SearchAction',
|
|
target: 'https://www.your-part.de/blogs?q={search_term_string}',
|
|
'query-input': 'required name=search_term_string',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
...marketingRoutes,
|
|
...authRoutes,
|
|
...socialRoutes,
|
|
...settingsRoutes,
|
|
...adminRoutes,
|
|
...falukantRoutes,
|
|
...blogRoutes,
|
|
...minigamesRoutes,
|
|
...personalRoutes,
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes
|
|
});
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
if (to.matched.some(record => record.meta.requiresAuth)) {
|
|
if (!store.getters.isLoggedIn) {
|
|
next('/');
|
|
} else if (!store.getters.user.active) {
|
|
next('/activate');
|
|
} else {
|
|
next();
|
|
}
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
|
|
router.afterEach((to) => {
|
|
applyRouteSeo(to);
|
|
});
|
|
|
|
export default router;
|