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:
@@ -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 || '';
|
||||
|
||||
Reference in New Issue
Block a user