Skip to content

Commit 32bbd2d

Browse files
committedSep 25, 2024
fix rss/atom/json feed permalinks to match original golang site, add meta tags for feed autodiscovery
1 parent 1db833f commit 32bbd2d

File tree

11 files changed

+35
-19
lines changed

11 files changed

+35
-19
lines changed
 

‎links.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
- [Devon Govett on X: "More design systems should use utilities over style components..."](https://x.com/devongovett/status/1836770668953620640)
5151
- [Design System Retrospective | Kyle Shevlin](https://kyleshevlin.com/design-system-retrospective/)
5252
- [Unit Test 11ty Pages With Vitest and Typescript | Khalid Abuhakmeh](https://khalidabuhakmeh.com/unit-test-11ty-pages-with-vitest-and-typescript)
53+
- [rss autodiscovery](https://www.petefreitag.com/blog/rss-autodiscovery/)
5354
- [tailwindcss as a utility generator with eleventy](https://eleventy-excellent.netlify.app/blog/what-is-tailwind-css-doing-here/)
5455
- [tailwindcss v4 alpha](https://tailwindcss.com/blog/tailwindcss-v4-alpha#try-out-the-alpha)
5556

‎netlify.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[[redirects]]
22
from = "/blog/feed.xml"
3-
to = "/feeds/rss.xml"
3+
to = "/words/feed.rss.xml"
44
status = 301
5-

‎src/_data/metadata.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import site from './site.js';
2+
3+
/**
4+
* Metadata for RSS/Atom/JSON feeds
5+
*/
6+
const metadata = /** @type {const} */ ({
7+
title: `Ben Smith's Blog`,
8+
subtitle: `Ben's writings and thoughts about tech`,
9+
language: 'en',
10+
url: site.url,
11+
author: site.author,
12+
});
13+
14+
export default metadata;

‎src/_data/site.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export default /** @type {const} */ ({
1+
/**
2+
* Global site configuration data
3+
*/
4+
const site = /** @type {const} */ ({
25
title: 'Ben Smith - Full Stack Web Developer',
36
url: 'https://bensmith.sh',
47
author: {
@@ -9,3 +12,5 @@ export default /** @type {const} */ ({
912
"I'm a web developer with a passion for the command line, coffee, and crafting delightful user experiences for the web!",
1013
favicon: '/assets/favicon.ico',
1114
});
15+
16+
export default site;

‎src/_includes/components/main-nav.webc

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{ url: '/', text: 'Ben Smith' },
1313
{ url: '/projects/', text: 'Projects' },
1414
{ url: '/words/', text: 'Writing' },
15-
{ url: '/feeds/', text: 'RSS' },
15+
{ url: '/words/feed/', text: 'RSS' },
1616
];
1717
</script>
1818

‎src/_includes/layouts/base-html.webc

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<link href='/assets/young-serif.css' rel='preload' as='style' webc:keep>
1919
<link href='/assets/young-serif.css' rel='stylesheet' webc:keep>
2020

21+
<!--- rss feeds --->
22+
<link href='/words/feed.rss.xml' :title='`RSS Feed for ${metadata.title}`' rel='alternate' type='application/rss+xml'>
23+
<link href='/words/feed.atom.xml' :title='`Atom Feed for ${metadata.title}`' rel='alternate' type='application/atom+xml'>
24+
<link href='/words/feed.json' :title='`JSON Feed for ${metadata.title}`' rel='alternate' type='application/json'>
25+
2126
<!---
2227
minified catppuccin-mocha prismjs theme
2328
https://github.com/catppuccin/prismjs/blob/main/themes/mocha.css

‎src/feeds/atom.njk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
{
3-
permalink: '/feeds/atom.xml',
3+
permalink: '/words/feed.atom.xml',
44
title: 'Atom',
55
eleventyExcludeFromCollections: true,
66
}

‎src/feeds/feeds.11tydata.js

-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
import site from '#src/_data/site.js';
2-
31
export default {
42
layout: null,
5-
metadata: {
6-
title: `Ben Smith's Blog`,
7-
subtitle: `Ben's writings and thoughts about tech`,
8-
language: 'en',
9-
url: site.url,
10-
author: site.author,
11-
},
123
eleventyImport: {
134
collections: ['posts'],
145
},

‎src/feeds/index.webc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
{
3+
permalink: '/words/feed/',
34
layout: 'layouts/base.webc',
45
title: 'Feeds',
56
}
@@ -10,9 +11,9 @@
1011

1112
<nav class='feeds-list-nav' aria-labelledby='feeds-title'>
1213
<ul class="feeds-list">
13-
<li><a href="/feeds/rss.njk">RSS</a></li>
14-
<li><a href="/feeds/atom.njk">Atom</a></li>
15-
<li><a href="/feeds/json.njk">JSON</a></li>
14+
<li><a href="/words/feed.rss.xml">RSS</a></li>
15+
<li><a href="/words/feed.atom.xml">Atom</a></li>
16+
<li><a href="/words/feed.json">JSON</a></li>
1617
</ul>
1718
</nav>
1819

‎src/feeds/json.njk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
{
3-
permalink: '/feeds/rss.json',
3+
permalink: '/words/feed.json',
44
title: 'JSON',
55
eleventyExcludeFromCollections: true,
66
}

‎src/feeds/rss.njk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
{
3-
permalink: '/feeds/rss.xml',
3+
permalink: '/words/feed.rss.xml',
44
title: 'RSS',
55
eleventyExcludeFromCollections: true,
66
}

0 commit comments

Comments
 (0)
Please sign in to comment.