fixed project n5 and blog XML feed generation
This commit is contained in:
@@ -1,26 +1,25 @@
|
|||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
import { posts, type BlogPostDetails } from "../posts";
|
import { posts } from "../posts";
|
||||||
|
|
||||||
const xml = (tposts: Map<string, BlogPostDetails>) => `<rss version="2.0">
|
const xml = () => `<rss version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
<title>denizk0461's Blog</title>
|
<title>denizk0461's Blog</title>
|
||||||
<link>https://denizk0461.dev/blog/</link>
|
<link>https://denizk0461.dev/blog/</link>
|
||||||
<description><![CDATA[denizk0461 blogs about stuff here]]></description>
|
<description><![CDATA[denizk0461 blogs about stuff here]]></description>${getEntries()}
|
||||||
${getEntries()}
|
</channel>
|
||||||
</channel>
|
|
||||||
</rss>`;
|
</rss>`;
|
||||||
|
|
||||||
function getEntries(): String {
|
function getEntries(): String {
|
||||||
var val = "";
|
var val = "";
|
||||||
var entries = posts.entries().map((post, index) =>
|
var entries = posts.map((entry, _) =>
|
||||||
`<item>
|
`
|
||||||
<title><![CDATA[${post[1].title}]]></title>
|
<item>
|
||||||
<description><![CDATA[${post[1].description}]]></description>
|
<title><![CDATA[${entry.post.title}]]></title>
|
||||||
<link>https://denizk0461.dev/blog/${post[0]}</link>
|
<description><![CDATA[${entry.post.description}]]></description>
|
||||||
<guid isPermaLink="true">https://denizk0461.dev/blog/${post[0]}</guid>
|
<link>https://denizk0461.dev/blog/${entry.key}</link>
|
||||||
<pubDate><![CDATA[${new Date(`${post[1].date}T${post[1].time}`).toUTCString()}]]></pubDate>
|
<guid isPermaLink="true">https://denizk0461.dev/blog/${entry.key}</guid>
|
||||||
</item>
|
<pubDate><![CDATA[${new Date(`${entry.post.date}T${entry.post.time}`).toUTCString()}]]></pubDate>
|
||||||
`)
|
</item>`)
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
val += entry;
|
val += entry;
|
||||||
})
|
})
|
||||||
@@ -33,6 +32,6 @@ export async function GET() {
|
|||||||
'Cache-Control': 'max-age=0, s-maxage=600',
|
'Cache-Control': 'max-age=0, s-maxage=600',
|
||||||
'Content-Type': 'application/xml',
|
'Content-Type': 'application/xml',
|
||||||
};
|
};
|
||||||
const body = xml(posts);
|
const body = xml();
|
||||||
return new Response(body);
|
return new Response(body);
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ export interface BlogPostDetails {
|
|||||||
|
|
||||||
// Banner image title. If empty, defaults to banner.webp
|
// Banner image title. If empty, defaults to banner.webp
|
||||||
banner: string;
|
banner: string;
|
||||||
|
bannerAlt: string;
|
||||||
|
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@@ -35,8 +36,9 @@ export const posts: BlogPostLink[] = [
|
|||||||
date: "2026-01-31",
|
date: "2026-01-31",
|
||||||
time: "20:24",
|
time: "20:24",
|
||||||
banner: "colossus.webp",
|
banner: "colossus.webp",
|
||||||
|
bannerAlt: "Colossus standing in the National Museum of Computing in Bletchley, UK",
|
||||||
title: "Lessons Learned",
|
title: "Lessons Learned",
|
||||||
description: "Colossus standing in the National Museum of Computing in Bletchley, UK.",
|
description: "A small note about how you should always check whether your finished work works as intended.",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -45,6 +47,7 @@ export const posts: BlogPostLink[] = [
|
|||||||
date: "2026-01-29",
|
date: "2026-01-29",
|
||||||
time: "16:42",
|
time: "16:42",
|
||||||
banner: "girl.webp",
|
banner: "girl.webp",
|
||||||
|
bannerAlt: "A small drawing of an anime-style girl's head.",
|
||||||
title: "Limitations",
|
title: "Limitations",
|
||||||
description: "Something about how boundaries can foster creativity.",
|
description: "Something about how boundaries can foster creativity.",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
import { posts, type DevlogPost } from "../posts";
|
import { posts } from "../posts";
|
||||||
|
|
||||||
const xml = (tposts: Map<string, DevlogPost>) => `<rss version="2.0">
|
const xml = () => `<rss version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
<title>Project N5 Devlog</title>
|
<title>Project N5 Devlog</title>
|
||||||
<link>https://denizk0461.dev/projects/projectn5/devlog/</link>
|
<link>https://denizk0461.dev/projects/projectn5/devlog/</link>
|
||||||
<description><![CDATA[Development log for the game Homesick by denizk0461]]></description>
|
<description><![CDATA[Development log for the game Project N5 by denizk0461]]></description>${getEntries()}
|
||||||
${getEntries()}
|
</channel>
|
||||||
</channel>
|
|
||||||
</rss>`;
|
</rss>`;
|
||||||
|
|
||||||
function getEntries(): String {
|
function getEntries(): String {
|
||||||
var val = "";
|
var val = "";
|
||||||
var entries = posts.entries().map((post, index) =>
|
var entries = posts.map((entry, _) =>
|
||||||
`<item>
|
`
|
||||||
<title><![CDATA[${post[1].title}]]></title>
|
<item>
|
||||||
<description><![CDATA[${post[1].description}]]></description>
|
<title><![CDATA[${entry.post.title}]]></title>
|
||||||
<link>https://denizk0461.dev/projects/projectn5/devlog/${post[0]}</link>
|
<description><![CDATA[${entry.post.description}]]></description>
|
||||||
<guid isPermaLink="true">https://denizk0461.dev/projects/projectn5/devlog/${post[0]}</guid>
|
<link>https://denizk0461.dev/projects/projectn5/devlog/${entry.key}</link>
|
||||||
<pubDate><![CDATA[${new Date(post[1].date).toUTCString()}]]></pubDate>
|
<guid isPermaLink="true">https://denizk0461.dev/projects/projectn5/devlog/${entry.key}</guid>
|
||||||
</item>
|
<pubDate><![CDATA[${new Date(entry.post.date).toUTCString()}]]></pubDate>
|
||||||
`)
|
</item>`)
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
val += entry;
|
val += entry;
|
||||||
})
|
})
|
||||||
@@ -33,6 +32,6 @@ export async function GET() {
|
|||||||
'Cache-Control': 'max-age=0, s-maxage=600',
|
'Cache-Control': 'max-age=0, s-maxage=600',
|
||||||
'Content-Type': 'application/xml',
|
'Content-Type': 'application/xml',
|
||||||
};
|
};
|
||||||
const body = xml(posts);
|
const body = xml();
|
||||||
return new Response(body);
|
return new Response(body);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user