Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit eb3df78

Browse files
committed
dev:updated-sitemap-generation-code
1 parent 0a67c23 commit eb3df78

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

next.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
4+
output: 'export',
5+
images: {
6+
unoptimized: true
7+
},
8+
trailingSlash: false,
9+
basePath: ''
510
};
611

712
export default nextConfig;

src/app/sitemap.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { getAllArticles } from '@/lib/markdown'
33

44
export const dynamic = 'force-static'
55

6-
export default function sitemap(): MetadataRoute.Sitemap {
6+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
77
const baseUrl = 'https://axialabsresearch.github.io'
88
const articles = getAllArticles()
99

10+
const currentDate = new Date().toISOString()
11+
1012
// Static pages
1113
const staticPages = [
1214
{
1315
url: baseUrl,
14-
lastModified: new Date(),
16+
lastModified: currentDate,
1517
changeFrequency: 'daily' as const,
1618
priority: 1,
1719
},
@@ -20,18 +22,23 @@ export default function sitemap(): MetadataRoute.Sitemap {
2022
// Article pages
2123
const articlePages = articles.map((article) => ({
2224
url: `${baseUrl}/article/${article.slug}`,
23-
lastModified: new Date(article.date),
25+
lastModified: new Date(article.date).toISOString(),
2426
changeFrequency: 'monthly' as const,
2527
priority: 0.8,
2628
}))
2729

2830
// Author pages
2931
const authorPages = articles.map((article) => ({
3032
url: `${baseUrl}/author/${article.author.toLowerCase().replace(/\s+/g, '-')}`,
31-
lastModified: new Date(article.date),
33+
lastModified: new Date(article.date).toISOString(),
3234
changeFrequency: 'weekly' as const,
3335
priority: 0.6,
3436
}))
3537

36-
return [...staticPages, ...articlePages, ...authorPages]
38+
// Deduplicate author pages by URL
39+
const uniqueAuthorPages = Array.from(
40+
new Map(authorPages.map(page => [page.url, page])).values()
41+
)
42+
43+
return [...staticPages, ...articlePages, ...uniqueAuthorPages]
3744
}

0 commit comments

Comments
 (0)