-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemap.ts
More file actions
46 lines (40 loc) · 1.27 KB
/
Copy pathsitemap.ts
File metadata and controls
46 lines (40 loc) · 1.27 KB
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
import { MetadataRoute } from 'next';
import { getSeriesSummaries } from '@/blog/model/series-group';
import { getSortedFeedData } from '@/blog/services/post-repository';
import {
SITE_FEED_PATH,
createSiteUrl,
type SitePath,
} from '@/site/config/site';
export default function sitemap(): MetadataRoute.Sitemap {
const feeds = getSortedFeedData();
const feedEntries = feeds.map((feed) => ({
url: createSiteUrl(`/blog/${feed.slug}`),
lastModified: feed.updated ?? feed.date,
changeFrequency: 'weekly' as const,
priority: 0.7,
}));
const seriesEntries = getSeriesSummaries(
feeds.filter((feed) => feed.category === 'Tech')
).map((series) => ({
url: createSiteUrl(`/engineering/series/${encodeURIComponent(series.id)}`),
lastModified: series.latestDate,
changeFrequency: 'weekly' as const,
priority: 0.6,
}));
const routePaths: SitePath[] = [
'',
'/engineering',
'/life',
'/resume',
SITE_FEED_PATH,
];
const routes = routePaths.map((route) => ({
url: createSiteUrl(route),
lastModified: new Date().toISOString().split('T')[0],
changeFrequency:
route === SITE_FEED_PATH ? ('daily' as const) : ('monthly' as const),
priority: 1,
}));
return [...routes, ...seriesEntries, ...feedEntries];
}