rss feed, fix blog header link
This commit is contained in:
parent
cb9a4158cc
commit
ba690649c0
5 changed files with 69 additions and 4 deletions
25
.eleventy.js
25
.eleventy.js
|
@ -10,6 +10,7 @@ const markdownitClass = require('@toycode/markdown-it-class');
|
||||||
const markdownitImageFigures = require('markdown-it-image-figures');
|
const markdownitImageFigures = require('markdown-it-image-figures');
|
||||||
const anchor = require('markdown-it-anchor');
|
const anchor = require('markdown-it-anchor');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
const { feedPlugin } = require("@11ty/eleventy-plugin-rss");
|
||||||
|
|
||||||
const expectedInputFormat = 'YYYY-MM-DD';
|
const expectedInputFormat = 'YYYY-MM-DD';
|
||||||
const defaultOuputFormat = 'LL';
|
const defaultOuputFormat = 'LL';
|
||||||
|
@ -48,7 +49,7 @@ const md = markdownit({
|
||||||
linkify: true,
|
linkify: true,
|
||||||
html: true,
|
html: true,
|
||||||
typographer: true,
|
typographer: true,
|
||||||
highlight: function (str, lang) {
|
highlight: function(str, lang) {
|
||||||
if (lang && hljs.getLanguage(lang)) {
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
try {
|
try {
|
||||||
return hljs.highlight(str, { language: lang }).value + `<span class="hljs-language-icon">${lang}</span>`;
|
return hljs.highlight(str, { language: lang }).value + `<span class="hljs-language-icon">${lang}</span>`;
|
||||||
|
@ -66,11 +67,31 @@ md.use(anchor, {
|
||||||
permalink: anchor.permalink.headerLink()
|
permalink: anchor.permalink.headerLink()
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function(eleventyConfig) {
|
||||||
let nunjucksEnvironment = new Nunjucks.Environment(
|
let nunjucksEnvironment = new Nunjucks.Environment(
|
||||||
new Nunjucks.FileSystemLoader("_includes")
|
new Nunjucks.FileSystemLoader("_includes")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
eleventyConfig.addPlugin(feedPlugin, {
|
||||||
|
type: "rss",
|
||||||
|
outputPath: "/blog/rss",
|
||||||
|
collection: {
|
||||||
|
name: "posts",
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
language: 'en',
|
||||||
|
title: 'Gaiet\'s Blog',
|
||||||
|
subtitle: 'Various writings on code, design, art and life.',
|
||||||
|
base: 'https://gaiety.me/blog',
|
||||||
|
author: {
|
||||||
|
name: 'Ava Gaiety W.',
|
||||||
|
email: 'ava+blog@wroten.me',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
eleventyConfig.configureErrorReporting({ allowMissingExtensions: true })
|
||||||
|
|
||||||
eleventyConfig.setLibrary('md', md);
|
eleventyConfig.setLibrary('md', md);
|
||||||
|
|
||||||
eleventyConfig.addPassthroughCopy('assets');
|
eleventyConfig.addPassthroughCopy('assets');
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
<h1 class="my-2 text-5xl tracking-tight fancy-heading inline-block motion-safe:animate-fade-right">
|
<h1 class="my-2 text-5xl tracking-tight fancy-heading inline-block motion-safe:animate-fade-right">
|
||||||
<span class="font-serif">{{ title }}</span>
|
<span class="font-serif">{{ title }}</span>
|
||||||
<small class="inline-block h-1 mt-0 text-xl text-text font-light">
|
<small class="inline-block h-1 mt-0 text-xl text-text font-light">
|
||||||
in <a href="/{{tags[0]}}" class="link">{{ tags[0] | capitalize }}</a>
|
in
|
||||||
|
{% if '/blog' in page.url %}
|
||||||
|
<a href="/blog" class="link">Blog</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/{{tags[0]}}" class="link">{{ tags[0] | capitalize }}</a>
|
||||||
|
{% endif %}
|
||||||
</small>
|
</small>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,6 +23,12 @@
|
||||||
<div class="p-4 sm:p-6 contrast-more:contrast-150">
|
<div class="p-4 sm:p-6 contrast-more:contrast-150">
|
||||||
{{ content | safe }}
|
{{ content | safe }}
|
||||||
</div>
|
</div>
|
||||||
|
{% if '/blog' in page.url %}
|
||||||
|
<hr class="border-yellow" />
|
||||||
|
<footer class="p-4 pt-0 sm:p-6 sm:pt-2 contrast-more:contrast-150 text-text">
|
||||||
|
Thanks for reading! This blog has a <a href="/blog/rss" rel="me" class="link">RSS feed</a> if you'd like to stay up to date.
|
||||||
|
</footer>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
layout: blog-list.njk
|
layout: blog-list.njk
|
||||||
description:
|
description:
|
||||||
Various writings on code, design, art and life.
|
Various writings on code, design, art and life. [RSS](/blog/rss)
|
||||||
eleventyExcludeFromCollections: true
|
eleventyExcludeFromCollections: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
32
package-lock.json
generated
32
package-lock.json
generated
|
@ -10,6 +10,7 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^3.0.0",
|
"@11ty/eleventy": "^3.0.0",
|
||||||
|
"@11ty/eleventy-plugin-rss": "^2.0.4",
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.3",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.3",
|
||||||
"@catppuccin/highlightjs": "^1.0.1",
|
"@catppuccin/highlightjs": "^1.0.1",
|
||||||
"@catppuccin/tailwindcss": "^0.1.6",
|
"@catppuccin/tailwindcss": "^0.1.6",
|
||||||
|
@ -185,6 +186,37 @@
|
||||||
"url": "https://opencollective.com/11ty"
|
"url": "https://opencollective.com/11ty"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@11ty/eleventy-plugin-rss": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-rss/-/eleventy-plugin-rss-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-LF60sGVlxGTryQe3hTifuzrwF8R7XbrNsM2xfcDcNMSliLN4kmB+7zvoLRySRx0AQDjqhPTAeeeT0ra6/9zHUQ==",
|
||||||
|
"dev": true,
|
||||||
|
"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.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.7.tgz",
|
||||||
|
"integrity": "sha512-6QE+duqSQ0GY9rENXYb4iPR4AYGdrFpqnmi59tFp9VrleOl0QSh8VlBr2yd6dlhkdtj7904poZW5PvGr9cMiJQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/11ty"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@11ty/eleventy-plugin-syntaxhighlight": {
|
"node_modules/@11ty/eleventy-plugin-syntaxhighlight": {
|
||||||
"version": "3.2.2",
|
"version": "3.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-syntaxhighlight/-/eleventy-plugin-syntaxhighlight-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-syntaxhighlight/-/eleventy-plugin-syntaxhighlight-3.2.2.tgz",
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^3.0.0",
|
"@11ty/eleventy": "^3.0.0",
|
||||||
|
"@11ty/eleventy-plugin-rss": "^2.0.4",
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.3",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.3",
|
||||||
"@catppuccin/highlightjs": "^1.0.1",
|
"@catppuccin/highlightjs": "^1.0.1",
|
||||||
"@catppuccin/tailwindcss": "^0.1.6",
|
"@catppuccin/tailwindcss": "^0.1.6",
|
||||||
|
|
Loading…
Add table
Reference in a new issue