feat(seo): add initial robots.ts and sitemap.ts
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
This commit is contained in:
parent
7c9bcd81a6
commit
b6337f4c85
2 changed files with 44 additions and 9 deletions
|
|
@ -1,12 +1,16 @@
|
|||
|
||||
import { MetadataRoute } from 'next'
|
||||
import { VERTICALS } from '@/config/verticals'
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
const baseUrl = 'https://fediversion.runfoo.run'
|
||||
|
||||
return {
|
||||
rules: {
|
||||
userAgent: '*',
|
||||
allow: '/',
|
||||
disallow: ['/admin/', '/api/'],
|
||||
disallow: ['/api/', '/admin/'],
|
||||
},
|
||||
sitemap: 'https://fediversion.runfoo.run/sitemap.xml',
|
||||
sitemap: `${baseUrl}/sitemap.xml`,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,53 @@
|
|||
import { MetadataRoute } from 'next'
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
import { MetadataRoute } from 'next'
|
||||
import { VERTICALS } from '@/config/verticals'
|
||||
import { getApiUrl } from '@/lib/api-config'
|
||||
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
const baseUrl = 'https://fediversion.runfoo.run'
|
||||
|
||||
// Static routes
|
||||
const routes = [
|
||||
'',
|
||||
'/shows',
|
||||
'/songs',
|
||||
'/venues',
|
||||
'/videos',
|
||||
'/stats',
|
||||
'/shows/upcoming',
|
||||
'/login',
|
||||
'/register',
|
||||
'/about',
|
||||
'/terms',
|
||||
'/privacy',
|
||||
].map((route) => ({
|
||||
url: `${baseUrl}${route}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'daily' as const,
|
||||
priority: route === '' ? 1 : 0.8,
|
||||
priority: 1,
|
||||
}))
|
||||
|
||||
return routes
|
||||
// Generate routes for each vertical
|
||||
const verticalRoutes = VERTICALS.flatMap((vertical) => [
|
||||
{
|
||||
url: `${baseUrl}/${vertical.slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'daily' as const,
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/${vertical.slug}/songs`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: `${baseUrl}/${vertical.slug}/shows`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.8,
|
||||
},
|
||||
])
|
||||
|
||||
// TODO: Fetch dynamic routes (shows, songs) from API once we have a performant way to get all slugs
|
||||
// For now, we rely on the main list pages being indexed and crawlers following links
|
||||
|
||||
return [...routes, ...verticalRoutes]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue