sitemap.ts 806 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { MetadataRoute } from 'next';
  2. import { allDocs, allGuides, allPages, allPosts } from '@/.contentlayer/generated';
  3. import { uiUrl } from '@/config/site';
  4. const pages = [
  5. 'testimonials',
  6. 'support',
  7. 'icons',
  8. 'guides',
  9. 'features',
  10. 'emails',
  11. 'emails/gallery',
  12. 'docs',
  13. 'blog'
  14. ];
  15. export default function sitemap(): MetadataRoute.Sitemap {
  16. return [
  17. {
  18. url: uiUrl,
  19. lastModified: new Date(),
  20. },
  21. ...pages.map((page) => ({
  22. url: `${uiUrl}/${page}`,
  23. lastModified: new Date(),
  24. })),
  25. ...allPages.map((page) => ({
  26. url: `${uiUrl}/${page.slugAsParams}`,
  27. lastModified: new Date(),
  28. })),
  29. ...[...allDocs, ...allGuides, ...allPosts].map((doc) => ({
  30. url: `${uiUrl}${doc.slug}`,
  31. lastModified: new Date(),
  32. })),
  33. ];
  34. }