add rss.xml

This commit is contained in:
Felix Roos
2024-01-18 12:49:22 +01:00
parent 9ba7b9b4d4
commit ae5e6e3ab8
5 changed files with 48 additions and 15 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<link rel="alternate" type="application/rss+xml" title={`RSS Feed for strudel.cc`} href="/rss.xml" />
<link rel="icon" type="image/svg+xml" href={`${baseNoTrailing}/favicon.ico`} />
<meta
@@ -24,7 +24,7 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL
<base href={BASE_URL} />
<!-- Scrollable a11y code helper -->
<script src{`${baseNoTrailing}/make-scrollable-code-focusable.js`} is:inline></script>
<script {`${baseNoTrailing}/make-scrollable-code-focusable.js`} is:inline></script>
<script src="/src/pwa.ts"></script>
<!-- this does not work for some reason: -->
+1 -9
View File
@@ -1,5 +1,5 @@
---
import { SITE, OPEN_GRAPH, Frontmatter } from '../config';
import { SITE, OPEN_GRAPH, type Frontmatter } from '../config';
export interface Props {
frontmatter: Frontmatter;
@@ -25,11 +25,3 @@ const imageAlt = frontmatter.image?.alt ?? OPEN_GRAPH.image.alt;
<meta property="og:image:alt" content={imageAlt} />
<meta name="description" property="og:description" content={frontmatter.description ?? SITE.description} />
<meta property="og:site_name" content={SITE.title} />
<!-- Twitter Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content={OPEN_GRAPH.twitter} />
<meta name="twitter:title" content={formattedContentTitle} />
<meta name="twitter:description" content={frontmatter.description ?? SITE.description} />
<meta name="twitter:image" content={canonicalImageSrc} />
<meta name="twitter:image:alt" content={imageAlt} />
+19
View File
@@ -0,0 +1,19 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
export async function GET(context) {
const posts = (await getCollection('blog')).filter((p) => !p.data.draft);
const options = {
title: 'Strudel Blog',
description:
'The Strudel Blog will keep you updated with the latest changes and things happening in the strudelsphere.',
site: context.site,
items: posts.map((post) => ({
link: `/${post.slug}/`,
title: post.data.title,
pubDate: post.data.date,
description: post.data.description,
})),
};
return rss(options);
}