ci-electrical/web/sitemap.ts

47 lines
1.8 KiB
TypeScript

import { MetadataRoute } from 'next'
const base = process.env.NEXT_PUBLIC_SITE_URL || 'https://www.cielectrical.com';
// Main pages with high priority
const mainPages = [
{ path: '', priority: 1.0, changefreq: 'weekly' },
{ path: '/about', priority: 0.8, changefreq: 'monthly' },
{ path: '/contact', priority: 0.9, changefreq: 'weekly' },
{ path: '/residential', priority: 0.9, changefreq: 'weekly' },
{ path: '/commercial', priority: 0.9, changefreq: 'weekly' },
{ path: '/reviews', priority: 0.7, changefreq: 'weekly' },
];
// Service pages
const servicePages = [
{ path: '/corpus-christi/emergency-electrician', priority: 0.8, changefreq: 'weekly' },
{ path: '/corpus-christi/panel-upgrades', priority: 0.8, changefreq: 'monthly' },
{ path: '/corpus-christi/ev-charger-install', priority: 0.8, changefreq: 'monthly' },
{ path: '/projects', priority: 0.7, changefreq: 'monthly' },
];
// Location pages
const locationPages = [
{ path: '/corpus-christi/electrician', priority: 0.8, changefreq: 'weekly' },
{ path: '/flour-bluff/electrician', priority: 0.8, changefreq: 'weekly' },
{ path: '/portland-tx/electrician', priority: 0.8, changefreq: 'weekly' },
{ path: '/aransas-pass/electrician', priority: 0.8, changefreq: 'weekly' },
{ path: '/rockport/electrician', priority: 0.8, changefreq: 'weekly' },
];
// API endpoints (lower priority)
const apiPages = [
{ path: '/api/contact', priority: 0.1, changefreq: 'never' },
];
// Combine all pages
const allPages = [...mainPages, ...servicePages, ...locationPages, ...apiPages];
export default function sitemap(): MetadataRoute.Sitemap {
return allPages.map((page) => ({
url: `${base}${page.path}`,
lastModified: new Date(),
changeFrequency: page.changefreq as 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never',
priority: page.priority,
}));
}