Implement multi-domain SEO improvements:
- Add metadata to login and login-verify pages to prevent indexing. - Update robots.txt to disallow additional sensitive paths. - Enhance sitemap generation to filter by city and include accurate last modified dates. - Refactor canonical URL generation to support multi-domain architecture, ensuring self-canonicalization for city domains. - Remove deprecated CanonicalHandler component and streamline canonical URL handling. - Introduce safe JSON-LD output to prevent XSS vulnerabilities. - Add payment layout with appropriate metadata to prevent indexing. - Conduct a comprehensive technical SEO audit and implement necessary fixes across the application.
This commit is contained in:
+3
-55
@@ -1,57 +1,5 @@
|
||||
// Utility functions for sitemap generation
|
||||
export const DOMAIN_CONFIG = {
|
||||
MAIN_DOMAIN: 'nobat724.com',
|
||||
MAX_SPECIALTY_COMBINATIONS: 20, // Limit specialty combinations to prevent too many URLs
|
||||
MAIN_CITIES: ['108', '104', '111', '117', '113'], // Tehran, Isfahan, Mashhad, Shiraz, Ahvaz
|
||||
};
|
||||
|
||||
export function isMainDomain(domain) {
|
||||
return domain === DOMAIN_CONFIG.MAIN_DOMAIN || domain.includes('localhost') || domain.includes('127.0.0.1');
|
||||
}
|
||||
|
||||
export function encodeUrlParam(param) {
|
||||
return encodeURIComponent(param || '');
|
||||
}
|
||||
|
||||
export function createSitemapUrl(baseUrl, path, params = {}) {
|
||||
let url = `${baseUrl}${path}`;
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value) {
|
||||
searchParams.append(key, value);
|
||||
}
|
||||
});
|
||||
|
||||
const queryString = searchParams.toString();
|
||||
const fullUrl = queryString ? `${url}?${queryString}` : url;
|
||||
|
||||
// Escape XML entities
|
||||
return escapeXml(fullUrl);
|
||||
}
|
||||
|
||||
export function escapeXml(str) {
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
export function createSitemapEntry(url, priority = 0.8, changeFrequency = 'weekly') {
|
||||
return {
|
||||
url,
|
||||
lastModified: new Date(),
|
||||
changeFrequency,
|
||||
priority,
|
||||
};
|
||||
}
|
||||
|
||||
export function limitArray(array, limit) {
|
||||
return limit > 0 ? array.slice(0, limit) : array;
|
||||
}
|
||||
import { buildCanonicalUrl } from '@/lib/getCanonicalUrl';
|
||||
|
||||
export function getBaseUrl(domain) {
|
||||
return `https://${domain}`;
|
||||
}
|
||||
return buildCanonicalUrl(domain, '/').replace(/\/$/, '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user