From ae5e6e3ab8a1d6987308a19e21b2e2f6fa10fc2a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 18 Jan 2024 12:49:22 +0100 Subject: [PATCH] add rss.xml --- pnpm-lock.yaml | 21 +++++++++++++++++++++ website/package.json | 9 +++++---- website/src/components/HeadCommon.astro | 4 ++-- website/src/components/HeadSEO.astro | 10 +--------- website/src/pages/rss.xml.js | 19 +++++++++++++++++++ 5 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 website/src/pages/rss.xml.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ed1d0d3d..61e3a8b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -490,6 +490,9 @@ importers: '@astrojs/react': specifier: ^3.0.9 version: 3.0.9(@types/react-dom@18.2.18)(@types/react@18.2.46)(react-dom@18.2.0)(react@18.2.0)(vite@5.0.11) + '@astrojs/rss': + specifier: ^4.0.2 + version: 4.0.2 '@astrojs/tailwind': specifier: ^5.1.0 version: 5.1.0(astro@4.0.8)(tailwindcss@3.4.0) @@ -890,6 +893,13 @@ packages: - vite dev: false + /@astrojs/rss@4.0.2: + resolution: {integrity: sha512-Hb9GKAyvsn5EUjZtB6SniesBScMQe7SQinEHLY5EFa74QEvgcWaXTmA0Mb0P3vqDSN3d/NTYbGivprrSAawfnA==} + dependencies: + fast-xml-parser: 4.3.3 + kleur: 4.1.5 + dev: false + /@astrojs/tailwind@5.1.0(astro@4.0.8)(tailwindcss@3.4.0): resolution: {integrity: sha512-BJoCDKuWhU9FT2qYg+fr6Nfb3qP4ShtyjXGHKA/4mHN94z7BGcmauQK23iy+YH5qWvTnhqkd6mQPQ1yTZTe9Ig==} peerDependencies: @@ -7182,6 +7192,13 @@ packages: /fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + /fast-xml-parser@4.3.3: + resolution: {integrity: sha512-coV/D1MhrShMvU6D0I+VAK3umz6hUaxxhL0yp/9RjfiYUfAv14rDhGQL+PLForhMdr0wq3PiV07WtkkNjJjNHg==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: false + /fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: @@ -12637,6 +12654,10 @@ packages: acorn: 8.11.3 dev: true + /strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + dev: false + /strong-log-transformer@2.1.0: resolution: {integrity: sha512-B3Hgul+z0L9a236FAUC9iZsL+nVHgoCJnqCbN588DjYxvGXaXaaFbfmQ/JhvKjZwsOukuR72XbHv71Qkug0HxA==} engines: {node: '>=4'} diff --git a/website/package.json b/website/package.json index 2fa4e8e1..a84527cf 100644 --- a/website/package.json +++ b/website/package.json @@ -16,6 +16,7 @@ "@astro-community/astro-embed-youtube": "^0.4.3", "@astrojs/mdx": "^2.0.3", "@astrojs/react": "^3.0.9", + "@astrojs/rss": "^4.0.2", "@astrojs/tailwind": "^5.1.0", "@docsearch/css": "^3.5.2", "@docsearch/react": "^3.5.2", @@ -23,21 +24,21 @@ "@heroicons/react": "^2.1.1", "@nanostores/persistent": "^0.9.1", "@nanostores/react": "^0.7.1", + "@strudel/codemirror": "workspace:*", "@strudel/core": "workspace:*", "@strudel/csound": "workspace:*", + "@strudel/desktopbridge": "workspace:*", + "@strudel/hydra": "workspace:*", "@strudel/midi": "workspace:*", "@strudel/mini": "workspace:*", "@strudel/osc": "workspace:*", + "@strudel/repl": "workspace:*", "@strudel/serial": "workspace:*", "@strudel/soundfonts": "workspace:*", "@strudel/tonal": "workspace:*", "@strudel/transpiler": "workspace:*", "@strudel/webaudio": "workspace:*", "@strudel/xen": "workspace:*", - "@strudel/codemirror": "workspace:*", - "@strudel/desktopbridge": "workspace:*", - "@strudel/hydra": "workspace:*", - "@strudel/repl": "workspace:*", "@supabase/supabase-js": "^2.39.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.10", diff --git a/website/src/components/HeadCommon.astro b/website/src/components/HeadCommon.astro index cb3e605a..a352a2c7 100644 --- a/website/src/components/HeadCommon.astro +++ b/website/src/components/HeadCommon.astro @@ -10,7 +10,7 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL - + - + diff --git a/website/src/components/HeadSEO.astro b/website/src/components/HeadSEO.astro index 556b50a7..413668c1 100644 --- a/website/src/components/HeadSEO.astro +++ b/website/src/components/HeadSEO.astro @@ -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; - - - - - - - - diff --git a/website/src/pages/rss.xml.js b/website/src/pages/rss.xml.js new file mode 100644 index 00000000..0aeb7bf4 --- /dev/null +++ b/website/src/pages/rss.xml.js @@ -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); +}