links rss

This commit is contained in:
Joshua Seigler 2025-07-04 02:22:45 -04:00
parent 82ae1ef877
commit e5e4dbacf0
4 changed files with 15 additions and 31 deletions

View file

@ -114,8 +114,10 @@ export default async (config) => {
config.addCollection("links", fetchShaarliWebroll) config.addCollection("links", fetchShaarliWebroll)
config.addCollection("combinedFeed", (collectionApi) => { config.addCollection("combinedFeed", (collectionApi) => {
return collectionApi.getAllSorted().filter(item => { return collectionApi.getAllSorted().filter((item) => {
return (item.data.tags ?? []).some(t => ['posts', 'recipes', 'links'].includes(t)) return (item.data.tags ?? []).some((t) =>
["posts", "recipes", "links"].includes(t)
)
}) })
}) })
@ -184,19 +186,23 @@ async function fetchShaarliWebroll() {
) )
} }
const entries = feedContent.map((entry) => { const entries = feedContent.map((entry) => {
const content = entry.content["#text"].split(
'\n<br>&#8212; <a href="https://links.apps.seigler.net/'
)[0]
return { return {
url: entry.link["@_href"], url: entry.link["@_href"],
date: new Date(entry.published),
content,
data: { data: {
title: entry.title, title: entry.title,
date: new Date(entry.published), date: new Date(entry.published),
description: entry.content["#text"].split( description: content,
'\n<br>&#8212; <a href="https://links.apps.seigler.net/' tags: ['links'],
)[0], // tags: entry.category
tags: entry.category // .map((category) => category["@_label"])
.map((category) => category["@_label"]) // .filter((category) => category !== "$webroll"),
.filter((category) => category !== "$webroll"),
}, },
} }
}) }).sort((a, b) => a.date.getTime() - b.date.getTime())
return entries return entries
} }

View file

@ -7,7 +7,6 @@ pagination:
filter: filter:
- all - all
- pages - pages
- links
- timeline - timeline
eleventyComputed: eleventyComputed:
finalLink: "{% if tag == 'combinedFeed' %}feed.xml{% else %}feeds/{{tag | slugify}}.xml{% endif %}" finalLink: "{% if tag == 'combinedFeed' %}feed.xml{% else %}feeds/{{tag | slugify}}.xml{% endif %}"

0
site/pages/links.md Normal file
View file

View file

@ -1,21 +0,0 @@
---
layout: "base.njk"
title: "Links"
permalink: /links/
useTitle: true
---
<main>
<section data-pagefind-body>
<ul class="collection">
{%- for item in collections.links -%}
<li>
<a href="{{item.url}}">{{item.data.title}}</a>
{%- if item.data.date -%}
<aside>{{item.data.date | formatDate("MMMM DD, YYYY") }}</aside>
{%- endif -%}
{{item.data.description | safe}}
</li>
{%- endfor -%}
</ul>
</section>
</main>