Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 3x 4x 3x 3x 3x 3x 4x 4x 4x 1x 1x 1x 4x | import { MetadataRoute } from 'next';
import { createAdminClient } from '@/lib/supabase/admin';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || 'https://proofid.in';
// Static pages
const staticPages: MetadataRoute.Sitemap = [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: 'daily',
priority: 1,
},
{
url: `${baseUrl}/login`,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.5,
},
{
url: `${baseUrl}/professionals`,
lastModified: new Date(),
changeFrequency: 'daily',
priority: 0.7,
},
{
url: `${baseUrl}/blog`,
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 0.6,
},
];
// Get all published profiles
try {
const supabase = createAdminClient();
const { data: profiles } = await supabase
.from('profiles')
.select('username, updated_at')
.eq('is_published', true)
.order('updated_at', { ascending: false });
const profilePages: MetadataRoute.Sitemap =
profiles?.map((profile) => ({
url: `${baseUrl}/${profile.username}`,
lastModified: new Date(profile.updated_at),
changeFrequency: 'weekly' as const,
priority: 0.8,
})) || [];
return [...staticPages, ...profilePages];
} catch (error) {
console.error('Sitemap generation error:', error);
return staticPages;
}
}
|