crisp-theme.git

git clone https://git.crispbyte.dev/crisp-theme.git

commit
ccecc41
parent
a2cb096
author
cheddar
date
2025-04-18 17:53:23 +0200 CEST
Add an RSS feed and site description
6 files changed,  +59, -3
M _data/metadata.js
+2, -1
1@@ -1,5 +1,6 @@
2 export default {
3-  title: 'CrispByte',
4+  title: 'Crisp Byte',
5+  description: 'Random writing by CheddarCrisp',
6   url: 'https://crispbyte.dev/',
7   author: {
8     name: 'CheddarCrisp',
M _includes/layouts/base.njk
+2, -0
1@@ -3,6 +3,8 @@
2   <head>
3     <meta name="viewport" content="width=device-width, initial-scale=1.0">
4     <title>{% if title %}{{ title  }} - {% endif %}{{ metadata.title }}</title>
5+    <meta name="description" content="{{ description or metadata.description }}">
6+		<link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
7     <link rel="stylesheet" href="/styles.css">
8   </head>
9   <body>
M _includes/socials.njk
+3, -1
 1@@ -1,6 +1,8 @@
 2 <nav name="Social Links" class="socials">
 3   <ul class="simple-list">
 4-    <li><a href="#" title="Posts RSS Feed"><img src="/img/feed-icon.svg"></a></li>
 5+    <li><a href="/posts.xml" title="Posts RSS Feed" type="application/atom+xml">
 6+      <img src="/img/feed-icon.svg"></a>
 7+    </li>
 8     <li><a href="https://forge.crispbyte.dev/cheddar" title="Git Profile"><img src="/img/git-icon.svg"></a></li>
 9     <li><a href="https://hachyderm.io/@cheddarcrisp" rel="me" title="Mastodon Profile">
10       <img src="/img/mastodon-icon.svg">
M eleventy.config.js
+20, -0
 1@@ -1,3 +1,6 @@
 2+import { feedPlugin } from "@11ty/eleventy-plugin-rss";
 3+
 4+import metadata from "./_data/metadata.js";
 5 import pluginFilters from "./_config/filters.js";
 6 
 7 export default async function(eleventyConfig) {
 8@@ -5,6 +8,23 @@ export default async function(eleventyConfig) {
 9 
10 	eleventyConfig.addPlugin(pluginFilters);
11 
12+  eleventyConfig.addPlugin(feedPlugin, {
13+    type: "atom",
14+    outputPath: "/feed.xml",
15+    collection: {
16+      name: "posts",
17+      limit: 10
18+    },
19+    metadata: {
20+      title: metadata.title,
21+      subtitle: metadata.description,
22+      base: metadata.url,
23+      author: {
24+        name: metadata.author.name
25+      }
26+    }
27+  })
28+
29   eleventyConfig.addCollection("series", collectionsApi => {
30     const seriesNames = collectionsApi.
31       getFilteredByTag("posts").
M package-lock.json
+30, -0
 1@@ -10,6 +10,7 @@
 2       "license": "IST",
 3       "dependencies": {
 4         "@11ty/eleventy": "^3.0.0",
 5+        "@11ty/eleventy-plugin-rss": "^2.0.3",
 6         "date-fns": "^4.1.0"
 7       }
 8     },
 9@@ -150,6 +151,35 @@
10         "url": "https://opencollective.com/11ty"
11       }
12     },
13+    "node_modules/@11ty/eleventy-plugin-rss": {
14+      "version": "2.0.3",
15+      "resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-rss/-/eleventy-plugin-rss-2.0.3.tgz",
16+      "integrity": "sha512-ubK97uahCLpKhORLfblgxLcoaNqTcKde1cH8CeRKNTFoUuuDSEjWZtodV9fKrg+uOp5X74dO43z1/io6hhs5Bw==",
17+      "license": "MIT",
18+      "dependencies": {
19+        "@11ty/eleventy-utils": "^2.0.0",
20+        "@11ty/posthtml-urls": "^1.0.1",
21+        "debug": "^4.4.0",
22+        "posthtml": "^0.16.6"
23+      },
24+      "funding": {
25+        "type": "opencollective",
26+        "url": "https://opencollective.com/11ty"
27+      }
28+    },
29+    "node_modules/@11ty/eleventy-plugin-rss/node_modules/@11ty/eleventy-utils": {
30+      "version": "2.0.1",
31+      "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.1.tgz",
32+      "integrity": "sha512-hicG0vPyqfLvgHJQLtoh3XAj6wUbLX4yY2se8bQLdhCIcxK46mt4zDpgcrYVP3Sjx4HPifQOdwRfOEECoUcyXQ==",
33+      "license": "MIT",
34+      "engines": {
35+        "node": ">=18"
36+      },
37+      "funding": {
38+        "type": "opencollective",
39+        "url": "https://opencollective.com/11ty"
40+      }
41+    },
42     "node_modules/@11ty/eleventy-utils": {
43       "version": "1.0.3",
44       "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz",
M package.json
+2, -1
 1@@ -2,7 +2,7 @@
 2   "name": "site-theme",
 3   "version": "1.0.0",
 4   "main": "index.js",
 5-  "type":"module",
 6+  "type": "module",
 7   "scripts": {
 8     "serve": "npx @11ty/eleventy --serve",
 9     "test": "echo \"Error: no test specified\" && exit 1"
10@@ -13,6 +13,7 @@
11   "description": "",
12   "dependencies": {
13     "@11ty/eleventy": "^3.0.0",
14+    "@11ty/eleventy-plugin-rss": "^2.0.3",
15     "date-fns": "^4.1.0"
16   }
17 }