Skip to content

Commit 7dc8f24

Browse files
committed
feat: update sitemap to fetch blog posts from API and enhance metadata
1 parent 9d7dd0f commit 7dc8f24

2 files changed

Lines changed: 45 additions & 16 deletions

File tree

app/sitemap.ts

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,57 @@
11
import { MetadataRoute } from 'next';
2-
import { generateSitemapData } from '@/lib/metadata';
2+
import { getBlogPosts } from '@/lib/api/blog';
3+
import type { BlogPost } from '@/types/blog';
34

4-
export default function sitemap(): MetadataRoute.Sitemap {
5-
const basePages = generateSitemapData();
5+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
6+
// Fetch real blog posts from API
7+
let blogPosts: MetadataRoute.Sitemap = [];
8+
try {
9+
const response = await getBlogPosts({
10+
status: 'PUBLISHED',
11+
limit: 1000, // Fetch all published posts
12+
});
13+
blogPosts = response.data.map((post: BlogPost) => ({
14+
url: `https://boundlessfi.xyz/blog/${post.slug}`,
15+
lastModified: new Date(post.updatedAt || post.publishedAt),
16+
changeFrequency: 'monthly' as const,
17+
priority: 0.7,
18+
}));
19+
} catch {
20+
// Silently fail if fetch fails, return empty array
21+
}
622

7-
// Add blog posts to sitemap (in a real app, you'd fetch these from your CMS/database)
8-
const blogPosts = [
23+
const baseUrl = 'https://boundlessfi.xyz';
24+
return [
925
{
10-
url: 'https://boundlessfi.xyz/blog/getting-started-with-boundless',
26+
url: baseUrl,
1127
lastModified: new Date(),
12-
changeFrequency: 'monthly' as const,
13-
priority: 0.7,
28+
changeFrequency: 'weekly',
29+
priority: 1.0,
1430
},
1531
{
16-
url: 'https://boundlessfi.xyz/blog/milestone-based-funding-guide',
32+
url: `${baseUrl}/about`,
1733
lastModified: new Date(),
18-
changeFrequency: 'monthly' as const,
19-
priority: 0.7,
34+
changeFrequency: 'monthly',
35+
priority: 0.8,
2036
},
2137
{
22-
url: 'https://boundlessfi.xyz/blog/stellar-blockchain-benefits',
38+
url: `${baseUrl}/blog`,
2339
lastModified: new Date(),
24-
changeFrequency: 'monthly' as const,
25-
priority: 0.7,
40+
changeFrequency: 'weekly',
41+
priority: 0.9,
2642
},
43+
{
44+
url: `${baseUrl}/projects`,
45+
lastModified: new Date(),
46+
changeFrequency: 'weekly',
47+
priority: 0.9,
48+
},
49+
{
50+
url: `${baseUrl}/me`,
51+
lastModified: new Date(),
52+
changeFrequency: 'monthly',
53+
priority: 0.6,
54+
},
55+
...blogPosts,
2756
];
28-
29-
return [...basePages, ...blogPosts];
3057
}

lib/metadata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export const pageMetadata: Record<string, PageMetadata> = {
7171
'projects',
7272
'funding',
7373
'milestones',
74+
'boundless',
75+
'stellar blockchain',
7476
],
7577
ogImage:
7678
'https://res.cloudinary.com/danuy5rqb/image/upload/v1759143589/bondless-og-image_jufgnu.png',

0 commit comments

Comments
 (0)