rss for every category
This commit is contained in:
parent
cd6347f8c2
commit
0dde8aff3d
12 changed files with 90 additions and 88 deletions
7
assets/icons/rss.svg
Normal file
7
assets/icons/rss.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!-- License: MIT. Made by edent: https://github.com/edent/SuperTinyIcons -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
aria-label="RSS" role="img"
|
||||
viewBox="0 0 512 512"><rect
|
||||
width="512" height="512"
|
||||
rx="15%"
|
||||
fill="transparent"/><circle cx="145" cy="367" r="35" fill="#fff"/><path fill="none" stroke="#fff" stroke-width="60" d="M109 241c89 0 162 73 162 162m114 0c0-152-124-276-276-276"/></svg>
|
After Width: | Height: | Size: 392 B |
|
@ -1,55 +0,0 @@
|
|||
<?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>
|
1
assets/simple-atom.css
Normal file
1
assets/simple-atom.css
Normal file
File diff suppressed because one or more lines are too long
|
@ -9,11 +9,11 @@
|
|||
<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" />
|
||||
<link rel="stylesheet" href="/simple-atom.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
<img alt="feed icon" src="https://www.vectorlogo.zone/logos/rss/rss-tile.svg" style="height:1em;vertical-align:middle;" /> 
|
||||
<img alt="feed icon" src="/icons/rss.svg" style="height:1em;vertical-align:middle;" /> 
|
||||
<xsl:value-of select="/atom:feed/atom:title"/>
|
||||
</h1>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import utc from "dayjs/plugin/utc.js"
|
|||
import site from "./site/_data/site.js"
|
||||
import clean from "eleventy-plugin-clean"
|
||||
import toc from "eleventy-plugin-toc"
|
||||
import { feedPlugin as EleventyFeedPlugin } from "@11ty/eleventy-plugin-rss"
|
||||
import EleventyFeedPlugin from "@11ty/eleventy-plugin-rss"
|
||||
import EleventyVitePlugin from "@11ty/eleventy-plugin-vite"
|
||||
import { ViteMinifyPlugin } from "vite-plugin-minify"
|
||||
import { execSync } from "child_process"
|
||||
|
@ -112,7 +112,7 @@ export default async (config) => {
|
|||
)
|
||||
})
|
||||
|
||||
config.addCollection("webroll", fetchShaarliWebroll)
|
||||
config.addCollection("links", fetchShaarliWebroll)
|
||||
|
||||
config.addFilter("toISOString", (dateString) => {
|
||||
return new Date(dateString).toISOString()
|
||||
|
@ -129,25 +129,7 @@ export default async (config) => {
|
|||
const buildTime = new Date().toISOString().replace(/[:.-]/g, "")
|
||||
config.addGlobalData("buildTime", buildTime)
|
||||
|
||||
config.addPlugin(EleventyFeedPlugin, {
|
||||
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",
|
||||
})
|
||||
config.addPlugin(EleventyFeedPlugin)
|
||||
|
||||
config.addPlugin(EleventyVitePlugin, {
|
||||
viteOptions: {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
const isDev = process.env.ELEVENTY_ENV === "development";
|
||||
|
||||
const baseUrl = isDev ? "http://localhost:8080" : "https://joshua.seigler.net";
|
||||
const baseUrl = isDev ? "http://localhost:8080/" : "https://joshua.seigler.net/";
|
||||
|
||||
export default {
|
||||
language: "en-US",
|
||||
title: "joshua.seigler.net",
|
||||
description: "Personal homepage of Joshua Seigler",
|
||||
baseUrl,
|
||||
author: "Joshua Seigler",
|
||||
};
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
{%- if cover %}
|
||||
<div class="cover">
|
||||
<img src="{{ cover | url }}" alt="" loading="eager">
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ title }}{% if rssUrl %}<a class="rss" href="{{rssUrl}}"></a>{% endif %}</h1>
|
||||
</div>
|
||||
{%- else %}
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ title }}{% if rssUrl %}<a class="rss" href="{{rssUrl}}"></a>{% endif %}</h1>
|
||||
{%- endif %}
|
||||
<div class="header-meta">
|
||||
{%- if date and not omitMetadata -%}
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
eleventyComputed:
|
||||
title: "{{ page.fileSlug | capitalize }}"
|
||||
tag: "{{ page.fileSlug }}"
|
||||
title: "{{ tag | capitalize }}"
|
||||
rssUrl: "
|
||||
{%- if tag == 'posts' -%}
|
||||
/feed.xml
|
||||
{%- else -%}
|
||||
{%- if tag != 'music' -%}
|
||||
/feeds/{{tag}}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
"
|
||||
---
|
||||
|
||||
{%- from "components/collectionList.njk" import collectionList with context -%}
|
||||
|
@ -9,11 +19,10 @@ eleventyComputed:
|
|||
<section data-pagefind-body>
|
||||
{{ content | safe }}
|
||||
</section>
|
||||
{% set tag = page.fileSlug %}
|
||||
{% if collections[tag] %}
|
||||
{% if tag === "posts" %}
|
||||
{% include "-taglist.njk" %}
|
||||
{% endif %}
|
||||
{{ collectionList(tag) }}
|
||||
{% endif %}
|
||||
</main>
|
||||
</main>
|
||||
|
|
|
@ -515,6 +515,21 @@ h4 {
|
|||
h1 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
a.rss {
|
||||
float: right;
|
||||
height: 1lh;
|
||||
width: 1lh;
|
||||
margin: 0 0 0 0.5rem;
|
||||
--glowColor: #F80A;
|
||||
background: url("/icons/rss.svg");
|
||||
border-radius: 0.25em;
|
||||
opacity: 0.25;
|
||||
transition: 5s opacity;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
.header-meta {
|
||||
font-size: var(--s-1);
|
||||
> * + *:not(:empty)::before {
|
||||
|
|
40
site/feed.njk
Normal file
40
site/feed.njk
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
eleventyExcludeFromCollections: true
|
||||
pagination:
|
||||
data: collections
|
||||
size: 1
|
||||
alias: tag
|
||||
filter:
|
||||
- all
|
||||
- pages
|
||||
- links
|
||||
- timeline
|
||||
eleventyComputed:
|
||||
finalLink: "{% if tag == 'posts' %}feed.xml{% else %}feeds/{{tag | slugify}}.xml{% endif %}"
|
||||
permalink: "/assets/{{finalLink}}"
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml-stylesheet type="text/xsl" href="/simple-atom.xslt"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ site.language }}">
|
||||
<title>{{ site.title }} - {{ tag }}</title>
|
||||
<subtitle>{{ collections.pages[tag].data.description or site.description }}</subtitle>
|
||||
<link href="{{ site.baseUrl }}{{ finalLink }}" rel="self" />
|
||||
<link href="{{ site.baseUrl | addPathPrefixToFullUrl }}" />
|
||||
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||
<id>{{ site.baseUrl | addPathPrefixToFullUrl }}</id>
|
||||
<author>
|
||||
<name>{{ site.author.name }}</name>
|
||||
</author>
|
||||
{%- for entry in collections[tag] | reverse %}
|
||||
{%- if entry.url and entry.date -%}
|
||||
{%- set absolutePostUrl %}{{ entry.url | htmlBaseUrl(site.baseUrl) }}{% endset %}
|
||||
<entry>
|
||||
<title>{{ entry.data.title }}</title>
|
||||
<link href="{{ absolutePostUrl }}" />
|
||||
<updated>{{ entry.date | dateToRfc3339 }}</updated>
|
||||
<id>{{ absolutePostUrl }}</id>
|
||||
<content type="html">{{ entry.content | renderTransforms(entry.data.page, site.baseUrl) }}</content>
|
||||
</entry>
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
</feed>
|
|
@ -7,7 +7,7 @@ useTitle: true
|
|||
<main>
|
||||
<section data-pagefind-body>
|
||||
<ul class="collection">
|
||||
{%- for item in collections.webroll -%}
|
||||
{%- for item in collections.links -%}
|
||||
<li>
|
||||
<a href="{{item.url}}">{{item.data.title}}</a>
|
||||
{%- if item.data.date -%}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
eleventyComputed:
|
||||
title: "Posts tagged #{{ tag }}"
|
||||
pagination:
|
||||
data: collections
|
||||
size: 1
|
||||
|
@ -10,8 +8,11 @@ pagination:
|
|||
- posts
|
||||
- recipes
|
||||
- timeline
|
||||
permalink: /tags/{{ tag | slugify }}/
|
||||
useTitle: true
|
||||
eleventyComputed:
|
||||
title: "Posts tagged #{{ tag }}"
|
||||
permalink: /tags/{{ tag | slugify }}/
|
||||
rssUrl: /feeds/{{ tag | slugify }}.xml
|
||||
---
|
||||
{%- from "components/collectionList.njk" import collectionList with context -%}
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue