next-sitemap.config.cjs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /** @type {import('next-sitemap').IConfig} */
  2. module.exports = {
  3. siteUrl: process.env.NEXT_PUBLIC_SITE_URL || 'https://roocode.com',
  4. generateRobotsTxt: true,
  5. generateIndexSitemap: false, // We don't need index sitemap for a small site
  6. changefreq: 'monthly',
  7. priority: 0.7,
  8. sitemapSize: 5000,
  9. exclude: [
  10. '/api/*',
  11. '/server-sitemap-index.xml',
  12. '/404',
  13. '/500',
  14. '/_not-found',
  15. ],
  16. robotsTxtOptions: {
  17. policies: [
  18. {
  19. userAgent: '*',
  20. allow: '/',
  21. },
  22. ],
  23. additionalSitemaps: [
  24. // Add any additional sitemaps here if needed in the future
  25. ],
  26. },
  27. // Custom transform function to set specific priorities and change frequencies
  28. transform: async (config, path) => {
  29. // Set custom priority for specific pages
  30. let priority = config.priority;
  31. let changefreq = config.changefreq;
  32. if (path === '/') {
  33. priority = 1.0;
  34. changefreq = 'yearly';
  35. } else if (path === '/enterprise' || path === '/evals') {
  36. priority = 0.8;
  37. changefreq = 'monthly';
  38. } else if (path === '/privacy' || path === '/terms') {
  39. priority = 0.5;
  40. changefreq = 'yearly';
  41. }
  42. return {
  43. loc: path,
  44. changefreq,
  45. priority,
  46. lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
  47. alternateRefs: config.alternateRefs ?? [],
  48. };
  49. },
  50. additionalPaths: async (config) => {
  51. // Add any additional paths that might not be automatically discovered
  52. // This is useful for dynamic routes or API-generated pages
  53. // Add the /evals page since it's a dynamic route
  54. return [{
  55. loc: '/evals',
  56. changefreq: 'monthly',
  57. priority: 0.8,
  58. lastmod: new Date().toISOString(),
  59. }];
  60. // Add the /evals page since it's a dynamic route
  61. result.push({
  62. loc: '/evals',
  63. changefreq: 'monthly',
  64. priority: 0.8,
  65. lastmod: new Date().toISOString(),
  66. });
  67. return result;
  68. },
  69. };