chore: add back json feeds

This commit is contained in:
Cory Dransfeldt 2024-08-10 12:02:51 -07:00
parent 7d78546205
commit 74279cf2d5
No known key found for this signature in database
15 changed files with 91 additions and 53 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "coryd.dev",
"version": "21.8.1",
"version": "21.8.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "21.8.1",
"version": "21.8.2",
"license": "MIT",
"dependencies": {
"@cdransf/api-text": "^1.4.0",

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "21.8.1",
"version": "21.8.2",
"description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module",
"scripts": {

View file

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:feedpress="https://feed.press/xmlns" version="1.0">
<xsl:template match="/">
<html>
<xsl:copy-of select="$html_TemplateHeader"/>
<xsl:apply-templates select="rss/channel"/>
</html>
</xsl:template>
<xsl:template match="channel">
<body class="main-wrapper">
<header class="main-title">
<h1><xsl:value-of select="title"/></h1>
<a href="{$feedUrl}" class="link-icon">
<svg class="rss-icon" stroke="var(--brand-rss)"></svg>
</a>
</header>
<main>
<section class="posts-wrapper">
<xsl:apply-templates select="item"/>
</section>
</main>
<footer>
<xsl:copy-of select="$html_FeedFooterScripts"/>
</footer>
</body>
</xsl:template>
<xsl:template match="item">
<article class="home-status article">
<header>
<h2>
<a href="{link}">
<xsl:value-of select="title"/>
</a>
</h2>
</header>
<p><xsl:value-of select="description"/></p>
<footer>
<div class="time-wrapper">
<time datetime="{pubDate}">
<xsl:value-of select="pubDate"/>
</time>
<span rel="author">
<xsl:value-of select="author"/>
</span>
</div>
</footer>
</article>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,21 @@
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ title }}",
"home_page_url": "{{ permalink | absoluteUrl: globals.url }}",
"feed_url": "{{ permalink | absoluteUrl: globals.url }}.json",
"description": "{{ description }}",
"icon": "https://cdn.coryd.dev/{{ globals.feed_image }}?class=w200&v={% appVersion %}",
"favicon": "https://cdn.coryd.dev/{{ globals.favicon_ico }}?class=w50&v={% appVersion %}",
"items": [
{%- assign entries = data | normalizeEntries: 20 -%}
{%- for entry in entries -%}
{
"id": "{{ entry.url | encodeAmp }}",
"url": "{{ entry.url | encodeAmp }}",
"title": "{{ entry.title | escape }}{%- if entry.authors %} via {{ entry.authors.name }}{%- endif %}{%- if entry.rating %} ({{ entry.rating }}){%- endif %}",
"content_text": "{{ entry.excerpt | escape }}",
"date_published": "{{ entry.date | stringToRFC822Date }}"
}{%- if forloop.last == false %},{%- endif -%}
{%- endfor %}
]
}

View file

@ -10,7 +10,7 @@
<image>
<title>{{ title }}</title>
<link>{{ permalink | absoluteUrl: globals.url }}</link>
<url>https://cdn.coryd.dev/{{ globals.feed_image }}</url>
<url>https://cdn.coryd.dev/{{ globals.feed_image }}?class=w200&v={% appVersion %}</url>
<width>144</width>
<height>144</height>
</image>

View file

@ -0,0 +1,13 @@
---
layout: null
eleventyExcludeFromCollections: true
permalink: "/feeds/all.json"
---
{% render "partials/feeds/json.liquid"
permalink:"/feeds/all"
title:"Cory Dransfeldt: all activity"
description:"All of the posts and activity from my site."
data:collections.allContent
updated:collections.allContent[0].date
site:site
%}

View file

@ -0,0 +1,14 @@
---
layout: null
eleventyExcludeFromCollections: true
permalink: "/feeds/books.json"
---
{%- assign bookData = books.all | bookStatus: 'finished' | bookSortDescending -%}
{% render "partials/feeds/json.liquid"
permalink:"/feeds/books"
title:"Cory Dransfeldt: books"
description:"Books I'm currently reading."
data:bookData
updated:bookData[0].date
site:site
%}

View file

@ -0,0 +1,13 @@
---
layout: null
eleventyExcludeFromCollections: true
permalink: "/feeds/posts.json"
---
{% render "partials/feeds/json.liquid"
permalink:"/feeds/posts"
title:"Cory Dransfeldt"
description:"Posts from my site."
data:posts
updated:posts[0].date
site:site
%}

View file

@ -0,0 +1,13 @@
---
layout: null
eleventyExcludeFromCollections: true
permalink: "/feeds/links.json"
---
{% render "partials/feeds/json.liquid"
permalink:"/feeds/links"
title:"Cory Dransfeldt: links"
description:"Links I've liked."
data:links
updated:links[0].date
site:site
%}

View file

@ -0,0 +1,13 @@
---
layout: null
eleventyExcludeFromCollections: true
permalink: "/feeds/movies.json"
---
{% render "partials/feeds/json.liquid"
permalink:"/feeds/movies"
title:"Cory Dransfeldt: movies"
description:"Movies I've watched recently."
data:movies.recentlyWatched
updated:movies.recentlyWatched[0].lastWatched
site:site
%}