Enhance SEO and URL handling in router and server

- Updated the router to ensure canonical URLs are correctly formatted, particularly for the home path.
- Added middleware in the server to remove tracking/session query parameters, preventing duplicate URLs from being indexed by Google.
- Set canonical link headers in SEO routes to assist search engines in URL attribution.

These changes improve SEO performance and ensure cleaner URL structures across the application.
This commit is contained in:
Torsten Schulz (local)
2026-03-30 09:05:12 +02:00
parent 06182a4a95
commit 27f928d8a4
3 changed files with 48 additions and 6 deletions

View File

@@ -243,7 +243,9 @@ function updateJsonLd(schema) {
router.beforeEach((to, from, next) => {
const meta = to.meta || {};
const pageUrl = `${SITE_URL}${to.path}`;
// Immer eine eindeutige kanonische URL (Home explizit mit / am Ende der Origin)
const path = to.path === '' ? '/' : to.path;
const pageUrl = path === '/' ? `${SITE_URL}/` : `${SITE_URL}${path}`;
const title = meta.title || 'SingleChat';
const description = meta.description || '';
const keywords = meta.keywords || '';