Skip to content

Commit b3e2168

Browse files
committed
metadata improvements
1 parent 1196e36 commit b3e2168

3 files changed

Lines changed: 48 additions & 10 deletions

File tree

app/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const siteConfig = {
2+
name: 'Lukas Reichart',
3+
author: 'Lukas Reichart',
4+
description: 'Software engineer passionate about cloud-native technologies, DevOps practices, and building production-ready applications. Featuring comprehensive DevOps workshops and technical blog posts.',
5+
url: 'https://lukasre.ch',
6+
ogImage: '/og-image.png',
7+
links: {
8+
github: 'https://github.com/lukasredev',
9+
sourceCode: 'https://github.com/lukasredev/web',
10+
},
11+
} as const

app/rss/route.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
11
import { siteConfig } from 'app/config'
2-
import { getBlogPosts, sortPostsByDate } from 'app/blog/utils'
2+
import { getBlogPosts, getWorkshopPosts } from 'app/blog/utils'
33

44
export async function GET() {
55
let allBlogs = await getBlogPosts()
6+
let allWorkshops = await getWorkshopPosts()
67

7-
const itemsXml = sortPostsByDate(allBlogs)
8+
const blogItems = allBlogs.map((post) => ({
9+
...post,
10+
type: 'blog' as const,
11+
path: `/blog/${post.slug}`,
12+
}))
13+
14+
const workshopItems = allWorkshops.map((post) => ({
15+
...post,
16+
type: 'workshop' as const,
17+
path: `/workshops/${post.slug}`,
18+
}))
19+
20+
const allItems = [...blogItems, ...workshopItems]
21+
22+
const itemsXml = allItems
23+
.sort((a, b) => {
24+
if (new Date(a.metadata.publishedAt) > new Date(b.metadata.publishedAt)) {
25+
return -1
26+
}
27+
return 1
28+
})
829
.map(
9-
(post) =>
30+
(item) =>
1031
`<item>
11-
<title>${post.metadata.title}</title>
12-
<link>${siteConfig.url}/blog/${post.slug}</link>
13-
<description>${post.metadata.summary || ''}</description>
32+
<title>${item.metadata.title}</title>
33+
<link>${siteConfig.url}${item.path}</link>
34+
<description>${item.metadata.summary || ''}</description>
1435
<pubDate>${new Date(
15-
post.metadata.publishedAt
36+
item.metadata.publishedAt
1637
).toUTCString()}</pubDate>
38+
<category>${item.type === 'blog' ? 'Blog' : 'Workshop'}</category>
1739
</item>`
1840
)
1941
.join('\n')

app/sitemap.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getBlogPosts } from 'app/blog/utils'
1+
import { getBlogPosts, getWorkshopPosts } from 'app/blog/utils'
22
import { siteConfig } from './config'
33

44
export const baseUrl = siteConfig.url
@@ -9,10 +9,15 @@ export default async function sitemap() {
99
lastModified: post.metadata.publishedAt,
1010
}))
1111

12-
let routes = ['', '/blog'].map((route) => ({
12+
let workshops = getWorkshopPosts().map((post) => ({
13+
url: `${siteConfig.url}/workshops/${post.slug}`,
14+
lastModified: post.metadata.publishedAt,
15+
}))
16+
17+
let routes = ['', '/blog', '/workshops'].map((route) => ({
1318
url: `${siteConfig.url}${route}`,
1419
lastModified: new Date().toISOString().split('T')[0],
1520
}))
1621

17-
return [...routes, ...blogs]
22+
return [...routes, ...blogs, ...workshops]
1823
}

0 commit comments

Comments
 (0)