Add an RSS feed and site description

This commit is contained in:
cheddar 2025-04-18 11:53:23 -04:00
parent a2cb0960ab
commit ccecc411b8
No known key found for this signature in database
6 changed files with 59 additions and 3 deletions

View file

@ -1,5 +1,6 @@
export default { export default {
title: 'CrispByte', title: 'Crisp Byte',
description: 'Random writing by CheddarCrisp',
url: 'https://crispbyte.dev/', url: 'https://crispbyte.dev/',
author: { author: {
name: 'CheddarCrisp', name: 'CheddarCrisp',

View file

@ -3,6 +3,8 @@
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% if title %}{{ title }} - {% endif %}{{ metadata.title }}</title> <title>{% if title %}{{ title }} - {% endif %}{{ metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}">
<link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
<link rel="stylesheet" href="/styles.css"> <link rel="stylesheet" href="/styles.css">
</head> </head>
<body> <body>

View file

@ -1,6 +1,8 @@
<nav name="Social Links" class="socials"> <nav name="Social Links" class="socials">
<ul class="simple-list"> <ul class="simple-list">
<li><a href="#" title="Posts RSS Feed"><img src="/img/feed-icon.svg"></a></li> <li><a href="/posts.xml" title="Posts RSS Feed" type="application/atom+xml">
<img src="/img/feed-icon.svg"></a>
</li>
<li><a href="https://forge.crispbyte.dev/cheddar" title="Git Profile"><img src="/img/git-icon.svg"></a></li> <li><a href="https://forge.crispbyte.dev/cheddar" title="Git Profile"><img src="/img/git-icon.svg"></a></li>
<li><a href="https://hachyderm.io/@cheddarcrisp" rel="me" title="Mastodon Profile"> <li><a href="https://hachyderm.io/@cheddarcrisp" rel="me" title="Mastodon Profile">
<img src="/img/mastodon-icon.svg"> <img src="/img/mastodon-icon.svg">

View file

@ -1,3 +1,6 @@
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
import metadata from "./_data/metadata.js";
import pluginFilters from "./_config/filters.js"; import pluginFilters from "./_config/filters.js";
export default async function(eleventyConfig) { export default async function(eleventyConfig) {
@ -5,6 +8,23 @@ export default async function(eleventyConfig) {
eleventyConfig.addPlugin(pluginFilters); eleventyConfig.addPlugin(pluginFilters);
eleventyConfig.addPlugin(feedPlugin, {
type: "atom",
outputPath: "/feed.xml",
collection: {
name: "posts",
limit: 10
},
metadata: {
title: metadata.title,
subtitle: metadata.description,
base: metadata.url,
author: {
name: metadata.author.name
}
}
})
eleventyConfig.addCollection("series", collectionsApi => { eleventyConfig.addCollection("series", collectionsApi => {
const seriesNames = collectionsApi. const seriesNames = collectionsApi.
getFilteredByTag("posts"). getFilteredByTag("posts").

30
package-lock.json generated
View file

@ -10,6 +10,7 @@
"license": "IST", "license": "IST",
"dependencies": { "dependencies": {
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-plugin-rss": "^2.0.3",
"date-fns": "^4.1.0" "date-fns": "^4.1.0"
} }
}, },
@ -150,6 +151,35 @@
"url": "https://opencollective.com/11ty" "url": "https://opencollective.com/11ty"
} }
}, },
"node_modules/@11ty/eleventy-plugin-rss": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-rss/-/eleventy-plugin-rss-2.0.3.tgz",
"integrity": "sha512-ubK97uahCLpKhORLfblgxLcoaNqTcKde1cH8CeRKNTFoUuuDSEjWZtodV9fKrg+uOp5X74dO43z1/io6hhs5Bw==",
"license": "MIT",
"dependencies": {
"@11ty/eleventy-utils": "^2.0.0",
"@11ty/posthtml-urls": "^1.0.1",
"debug": "^4.4.0",
"posthtml": "^0.16.6"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy-plugin-rss/node_modules/@11ty/eleventy-utils": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.1.tgz",
"integrity": "sha512-hicG0vPyqfLvgHJQLtoh3XAj6wUbLX4yY2se8bQLdhCIcxK46mt4zDpgcrYVP3Sjx4HPifQOdwRfOEECoUcyXQ==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy-utils": { "node_modules/@11ty/eleventy-utils": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz",

View file

@ -2,7 +2,7 @@
"name": "site-theme", "name": "site-theme",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"type":"module", "type": "module",
"scripts": { "scripts": {
"serve": "npx @11ty/eleventy --serve", "serve": "npx @11ty/eleventy --serve",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
@ -13,6 +13,7 @@
"description": "", "description": "",
"dependencies": { "dependencies": {
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-plugin-rss": "^2.0.3",
"date-fns": "^4.1.0" "date-fns": "^4.1.0"
} }
} }