Remove deprecated scripts for adding head-matter to wt_config.xml, including Python and Bash implementations, to streamline configuration management.
This commit is contained in:
79
client/src/router/index.js
Normal file
79
client/src/router/index.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import ChatView from '../views/ChatView.vue';
|
||||
import PartnersView from '../views/PartnersView.vue';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'chat',
|
||||
component: ChatView,
|
||||
meta: {
|
||||
title: 'SingleChat - Chat, Single-Chat und Bildaustausch',
|
||||
description: 'Willkommen auf SingleChat - deine erste Adresse für Chat, Single-Chat und Bildaustausch. Chatte mit Menschen aus aller Welt, finde neue Kontakte und teile Erinnerungen sicher und komfortabel.',
|
||||
keywords: 'Chat, Single-Chat, Bildaustausch, Online-Chat, Singles, Kontakte, Community'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/partners',
|
||||
name: 'partners',
|
||||
component: PartnersView,
|
||||
meta: {
|
||||
title: 'Partner - SingleChat',
|
||||
description: 'Unsere Partner und befreundete Seiten. Entdecke weitere interessante Angebote und Communities.',
|
||||
keywords: 'Partner, Links, befreundete Seiten, Community'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
});
|
||||
|
||||
// Meta-Tags dynamisch aktualisieren basierend auf Route
|
||||
router.beforeEach((to, from, next) => {
|
||||
// Aktualisiere Title
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title;
|
||||
}
|
||||
|
||||
// Aktualisiere Meta-Tags
|
||||
const updateMetaTag = (name, content, attribute = 'name') => {
|
||||
let element = document.querySelector(`meta[${attribute}="${name}"]`);
|
||||
if (!element) {
|
||||
element = document.createElement('meta');
|
||||
element.setAttribute(attribute, name);
|
||||
document.head.appendChild(element);
|
||||
}
|
||||
element.setAttribute('content', content);
|
||||
};
|
||||
|
||||
if (to.meta.description) {
|
||||
updateMetaTag('description', to.meta.description);
|
||||
updateMetaTag('og:description', to.meta.description, 'property');
|
||||
updateMetaTag('twitter:description', to.meta.description);
|
||||
}
|
||||
|
||||
if (to.meta.keywords) {
|
||||
updateMetaTag('keywords', to.meta.keywords);
|
||||
}
|
||||
|
||||
// Aktualisiere Open Graph URL
|
||||
const ogUrl = `https://ypchat.net${to.path}`;
|
||||
updateMetaTag('og:url', ogUrl, 'property');
|
||||
updateMetaTag('canonical', ogUrl, 'rel');
|
||||
|
||||
// Aktualisiere Canonical Link
|
||||
let canonicalLink = document.querySelector('link[rel="canonical"]');
|
||||
if (!canonicalLink) {
|
||||
canonicalLink = document.createElement('link');
|
||||
canonicalLink.setAttribute('rel', 'canonical');
|
||||
document.head.appendChild(canonicalLink);
|
||||
}
|
||||
canonicalLink.setAttribute('href', ogUrl);
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user