add rss feed
This commit is contained in:
parent
5f954a80f5
commit
79b5e06aca
11 changed files with 1079 additions and 1086 deletions
55
assets/rss.xsl
Normal file
55
assets/rss.xsl
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
<xsl:output method="html" />
|
||||||
|
<xsl:template match="/">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: "Inter",sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: hsl(217 17% 21%);
|
||||||
|
max-width: 1024px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
float: right;
|
||||||
|
height: 40px;
|
||||||
|
margin: 12px 0;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #4a66b9;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<xsl:element name="img">
|
||||||
|
<xsl:attribute name="src">
|
||||||
|
<xsl:value-of select="//channel/image/url" />
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:element>
|
||||||
|
<h1>
|
||||||
|
<xsl:value-of select="//channel/title" />
|
||||||
|
</h1>
|
||||||
|
<hr />
|
||||||
|
<xsl:apply-templates select="//item" />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="item">
|
||||||
|
<content-item>
|
||||||
|
<h2>
|
||||||
|
<a href="{link}">
|
||||||
|
<xsl:value-of select="title" />
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
<xsl:value-of select="description" />
|
||||||
|
</p>
|
||||||
|
</content-item>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
75
assets/simple-atom.xslt
Normal file
75
assets/simple-atom.xslt
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xsl:stylesheet version="3.0"
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||||
|
<xsl:template match="/">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="referrer" content="unsafe-url" />
|
||||||
|
<title><xsl:value-of select="/atom:feed/atom:title"/></title>
|
||||||
|
<link rel="stylesheet" href="https://www.rss.style/css/water.min.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
<img alt="feed icon" src="https://www.vectorlogo.zone/logos/rss/rss-tile.svg" style="height:1em;vertical-align:middle;" /> 
|
||||||
|
<xsl:value-of select="/atom:feed/atom:title"/>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<xsl:value-of select="/atom:feed/atom:subtitle"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This is the Atom <a href="https://www.rss.style/what-is-a-feed.html">news feed</a> for the 
|
||||||
|
<a><xsl:attribute name="href">
|
||||||
|
<xsl:value-of select="/atom:feed/atom:link[@rel='alternate']/@href | /atom:feed/atom:link[not(@rel)]/@href"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:value-of select="/atom:feed/atom:title"/></a> 
|
||||||
|
website.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>It is meant for <a href="https://www.rss.style/newsreaders.html">news readers</a>, not humans. Please copy-and-paste the URL into your news reader!</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<pre>
|
||||||
|
<code id="feedurl"><xsl:value-of select="/atom:feed/atom:link[@rel='self']/@href"/></code>
|
||||||
|
</pre>
|
||||||
|
<button
|
||||||
|
class="clipboard"
|
||||||
|
data-clipboard-target="#feedurl">
|
||||||
|
Copy to clipboard
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<xsl:for-each select="/atom:feed/atom:entry">
|
||||||
|
<details><summary>
|
||||||
|
<a>
|
||||||
|
<xsl:attribute name="href">
|
||||||
|
<xsl:value-of select="atom:id"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:value-of select="atom:title"/>
|
||||||
|
</a> - 
|
||||||
|
<xsl:value-of select="atom:updated" />
|
||||||
|
</summary>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="atom:content">
|
||||||
|
<xsl:value-of disable-output-escaping="yes" select="atom:content" />
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="atom:summary" />
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</details>
|
||||||
|
</xsl:for-each>
|
||||||
|
<p><xsl:value-of select="count(/atom:feed/atom:entry)"/> news items.</p>
|
||||||
|
<p><small>Powered by <a href="https://www.rss.style/"><img referrerpolicy="origin" src="https://www.rss.style/favicon.svg" style="height:1em;padding-right:0.25em;vertical-align:middle;" />RSS.Style</a></small></p>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
||||||
|
<script>
|
||||||
|
new ClipboardJS('.clipboard');
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -1,17 +1,18 @@
|
||||||
const fs = require("fs");
|
import fs from "fs";
|
||||||
const path = require("path");
|
import path from "path";
|
||||||
const md = require("markdown-it");
|
import md from "markdown-it";
|
||||||
const mdAnchor = require("markdown-it-anchor");
|
import mdAnchor from "markdown-it-anchor";
|
||||||
const mdFootnote = require("markdown-it-footnote");
|
import mdFootnote from "markdown-it-footnote";
|
||||||
const prettier = require("prettier");
|
import prettier from "prettier";
|
||||||
const dayjs = require("dayjs");
|
import dayjs from "dayjs";
|
||||||
const utc = require("dayjs/plugin/utc");
|
import utc from "dayjs/plugin/utc.js";
|
||||||
const clean = require("eleventy-plugin-clean");
|
import clean from "eleventy-plugin-clean";
|
||||||
const site = require("./site/_data/site");
|
import site from "./site/_data/site.js";
|
||||||
|
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
|
|
||||||
module.exports = (config) => {
|
export default (config) => {
|
||||||
const slugify = config.getFilter("slugify");
|
const slugify = config.getFilter("slugify");
|
||||||
const url = config.getFilter("url");
|
const url = config.getFilter("url");
|
||||||
const mdLib = md({
|
const mdLib = md({
|
||||||
|
@ -88,6 +89,26 @@ module.exports = (config) => {
|
||||||
const buildTime = new Date().toISOString().replace(/[:.-]/g, "");
|
const buildTime = new Date().toISOString().replace(/[:.-]/g, "");
|
||||||
config.addGlobalData("buildTime", buildTime);
|
config.addGlobalData("buildTime", buildTime);
|
||||||
|
|
||||||
|
config.addPlugin(feedPlugin, {
|
||||||
|
type: "atom", // "atom", ""rss", or "json"
|
||||||
|
outputPath: "/feed.xml",
|
||||||
|
collection: {
|
||||||
|
name: "posts", // iterate over `collections.posts`
|
||||||
|
limit: 0, // 0 means no limit
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
language: "en",
|
||||||
|
title: site.title,
|
||||||
|
subtitle: site.description,
|
||||||
|
base: site.baseUrl,
|
||||||
|
author: {
|
||||||
|
name: "Joshua Seigler",
|
||||||
|
// email: "", // Optional
|
||||||
|
},
|
||||||
|
},
|
||||||
|
stylesheet: "/simple-atom.xslt",
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: "site",
|
input: "site",
|
||||||
|
|
1972
package-lock.json
generated
1972
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"type": "module",
|
||||||
"name": "homepage-rewrite",
|
"name": "homepage-rewrite",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
@ -11,9 +12,11 @@
|
||||||
"author": "Joshua Seigler",
|
"author": "Joshua Seigler",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@11ty/eleventy": "^2.0.1",
|
"@11ty/eleventy": "^3.1.0",
|
||||||
|
"@11ty/eleventy-plugin-rss": "^2.0.4",
|
||||||
|
"@11ty/eleventy-upgrade-help": "^3.0.1",
|
||||||
"dayjs": "^1.11.11",
|
"dayjs": "^1.11.11",
|
||||||
"eleventy-plugin-clean": "^1.2.6",
|
"eleventy-plugin-clean": "^2.0.1",
|
||||||
"markdown-it-anchor": "^9.0.1",
|
"markdown-it-anchor": "^9.0.1",
|
||||||
"markdown-it-footnote": "^4.0.0",
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"prettier": "^3.3.1"
|
"prettier": "^3.3.1"
|
||||||
|
|
|
@ -2,7 +2,7 @@ const isDev = process.env.ELEVENTY_ENV === "development";
|
||||||
|
|
||||||
const baseUrl = isDev ? "localhost:8080" : "https://joshua.seigler.net/";
|
const baseUrl = isDev ? "localhost:8080" : "https://joshua.seigler.net/";
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
title: "joshua.seigler.net",
|
title: "joshua.seigler.net",
|
||||||
description: "Personal homepage of Joshua Seigler",
|
description: "Personal homepage of Joshua Seigler",
|
||||||
baseUrl,
|
baseUrl,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
<footer>
|
<footer>
|
||||||
© Joshua Seigler 2025. <a href="mailto:joshua@seigler.net?subject=Hello">Contact</a>
|
© Joshua Seigler 2025. - <a href="mailto:joshua@seigler.net?subject=Hello">Contact</a>
|
||||||
|
-
|
||||||
|
<a href="/feed.xml">RSS</a>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -22,6 +22,7 @@ title: Joshua's Homepage
|
||||||
<meta name="twitter:image" content="{{ cover | absoluteURL }}" />
|
<meta name="twitter:image" content="{{ cover | absoluteURL }}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<meta name="twitter:card" content="summary" />
|
<meta name="twitter:card" content="summary" />
|
||||||
|
<meta name="generator" content="{{ eleventy.generator }}">
|
||||||
</head>
|
</head>
|
||||||
<body data-font="english" data-path="{{page.url}}">
|
<body data-font="english" data-path="{{page.url}}">
|
||||||
{% include "-header.njk" %}
|
{% include "-header.njk" %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "post.njk",
|
layout: "post.njk",
|
||||||
permalink: "/posts/{{ slug | default:title | slugify }}/",
|
permalink: "/posts/{{ slug | default:title | slugify }}/",
|
||||||
tags: ["posts"],
|
tags: ["posts"],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "base.njk",
|
layout: "base.njk",
|
||||||
tags: ["recipes"],
|
tags: ["recipes"],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
tags: ["timeline"],
|
tags: ["timeline"],
|
||||||
permalink: false,
|
permalink: false,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue