mirror of
https://github.com/danbulant/design
synced 2026-06-19 14:21:37 +00:00
fix the rss feed
This commit is contained in:
parent
75ee719495
commit
3be02ece9a
4 changed files with 24 additions and 19 deletions
10
package.json
10
package.json
|
|
@ -12,16 +12,16 @@
|
|||
"@sveltejs/kit": "1.0.0-next.431",
|
||||
"mdsvex": "0.10.5",
|
||||
"svelte": "3.46.4",
|
||||
"vite-plugin-windicss": "^1.8.6"
|
||||
"vite-plugin-windicss": "^1.8.7"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@sveltejs/pancake": "^0.0.18",
|
||||
"katex": "0.15.2",
|
||||
"luxon": "2.3.1",
|
||||
"mdast-util-gfm-table": "^1.0.1",
|
||||
"micromark": "^3.0.5",
|
||||
"micromark-extension-gfm-table": "^1.0.3",
|
||||
"mdast-util-gfm-table": "^1.0.4",
|
||||
"micromark": "^3.0.10",
|
||||
"micromark-extension-gfm-table": "^1.0.5",
|
||||
"rehype-autolink-headings": "6.1.1",
|
||||
"rehype-katex-svelte": "1.0.3",
|
||||
"rehype-slug": "5.0.1",
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
"remark-parse": "10.0.1",
|
||||
"remark-twemoji": "0.1.1",
|
||||
"twemoji": "13.1.0",
|
||||
"unified": "^10.1.0",
|
||||
"unified": "^10.1.2",
|
||||
"vite": "^3.0.9",
|
||||
"xterm": "4.18.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ specifiers:
|
|||
'@sveltejs/pancake': ^0.0.18
|
||||
katex: 0.15.2
|
||||
luxon: 2.3.1
|
||||
mdast-util-gfm-table: ^1.0.1
|
||||
mdast-util-gfm-table: ^1.0.4
|
||||
mdsvex: 0.10.5
|
||||
micromark: ^3.0.5
|
||||
micromark-extension-gfm-table: ^1.0.3
|
||||
micromark: ^3.0.10
|
||||
micromark-extension-gfm-table: ^1.0.5
|
||||
rehype-autolink-headings: 6.1.1
|
||||
rehype-katex-svelte: 1.0.3
|
||||
rehype-slug: 5.0.1
|
||||
|
|
@ -20,9 +20,9 @@ specifiers:
|
|||
remark-twemoji: 0.1.1
|
||||
svelte: 3.46.4
|
||||
twemoji: 13.1.0
|
||||
unified: ^10.1.0
|
||||
unified: ^10.1.2
|
||||
vite: ^3.0.9
|
||||
vite-plugin-windicss: ^1.8.6
|
||||
vite-plugin-windicss: ^1.8.7
|
||||
xterm: 4.18.0
|
||||
|
||||
dependencies:
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
/**
|
||||
* @type {import("@sveltejs/kit").RequestHandler}
|
||||
*/
|
||||
export async function get(req) {
|
||||
const allPostFiles = import.meta.glob('../posts/**/*.md');
|
||||
export async function GET(req) {
|
||||
const allPostFiles = import.meta.glob('../**/*.md');
|
||||
|
||||
const allPosts = await Promise.all(
|
||||
Object.entries(allPostFiles).map(async ([path, resolver]) => {
|
||||
const { metadata } = await resolver();
|
||||
let postPath = path.slice(2, -3);
|
||||
if(postPath.endsWith('/index')) postPath = postPath.slice(0, -6);
|
||||
if(postPath.endsWith('/+page')) postPath = postPath.slice(0, -6);
|
||||
return {
|
||||
...metadata,
|
||||
path: postPath,
|
||||
|
|
@ -20,8 +20,7 @@ export async function get(req) {
|
|||
return new Date(b.date) - new Date(a.date)
|
||||
});
|
||||
|
||||
return {
|
||||
body: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
return new Response(`<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>Blog - Daniel Bulant</title>
|
||||
|
|
@ -35,12 +34,15 @@ export async function get(req) {
|
|||
<item>
|
||||
<title>${t.title}</title>
|
||||
<description>${t.description}</description>
|
||||
<link>https://danbulant.eu${t.path}</link>
|
||||
<link>https://danbulant.eu/posts${t.path}</link>
|
||||
<pubDate>${new Date(t.date).toUTCString()}</pubDate>
|
||||
<guid>${t.path}</guid>
|
||||
</item>`).join("\n")}
|
||||
|
||||
</channel>
|
||||
</rss>`
|
||||
};
|
||||
</rss>`, {
|
||||
headers: {
|
||||
'Content-Type': 'application/rss+xml'
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -13,7 +13,10 @@ const config = {
|
|||
kit: {
|
||||
adapter: adapter({
|
||||
precompress: true
|
||||
})
|
||||
}),
|
||||
prerender: {
|
||||
default: true
|
||||
}
|
||||
},
|
||||
extensions: ['.svelte', '.md'],
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue