feat: add SEO configuration with dynamic robots.txt and sitemap.xml generation
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
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();
|
||||
return queryString ? `${url}?${queryString}` : url;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
export function getBaseUrl(domain) {
|
||||
return `https://${domain}`;
|
||||
}
|
||||
Reference in New Issue
Block a user