feat: improve feeds

This commit is contained in:
Cory Dransfeldt 2024-11-15 16:53:25 -08:00
parent a71e910482
commit 1d185fe7cd
No known key found for this signature in database
7 changed files with 62 additions and 46 deletions

10
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "coryd.dev",
"version": "3.2.0",
"version": "3.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "3.2.0",
"version": "3.3.0",
"license": "MIT",
"dependencies": {
"@11ty/eleventy-fetch": "4.0.1",
@ -1674,9 +1674,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.61",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.61.tgz",
"integrity": "sha512-CcRGSBCBB6L9c3PBJWYYrBo6Bzeoi+GZTKvtuRtooJGWsINk+mOInZWcssU35zDTAwreVcrMimc9aMyPpehRNw==",
"version": "1.5.62",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.62.tgz",
"integrity": "sha512-t8c+zLmJHa9dJy96yBZRXGQYoiCEnHYgFwn1asvSPZSUdVxnB62A4RASd7k41ytG3ErFBA0TpHlKg9D9SQBmLg==",
"dev": true,
"license": "ISC"
},

View file

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

View file

@ -3,12 +3,12 @@ WITH feed_data AS (
SELECT
p.date AS content_date,
p.title,
p.description,
p.content AS description,
CONCAT('https://coryd.dev', p.url) AS url,
NULL AS image,
NULL AS rating,
p.tags,
json_build_object('title', p.title, 'url', CONCAT('https://coryd.dev', p.url), 'description', p.description, 'date', p.date) AS feed
json_build_object('title', p.title, 'url', CONCAT('https://coryd.dev', p.url), 'description', p.content, 'date', p.date) AS feed
FROM
optimized_posts p
UNION ALL
@ -20,11 +20,11 @@ WITH feed_data AS (
NULL AS image,
NULL AS rating,
l.tags,
json_build_object('title', l.title, 'url', l.link, 'description', l.description, 'date', l.date) AS feed
json_build_object('title', CONCAT(l.title, ' via ', l.name), 'url', l.link, 'description', l.description, 'date', l.date) AS feed
FROM
optimized_links l
UNION ALL
SELECT
UNION ALL
SELECT
b.date_finished AS content_date,
b.title,
b.description,
@ -33,14 +33,18 @@ WITH feed_data AS (
b.rating,
b.tags,
CASE WHEN LOWER(b.status) = 'finished' THEN
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.url), 'description', b.description, 'image', b.image, 'rating', b.rating, 'date', b.date_finished)
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.url), 'description', CASE WHEN b.review IS NOT NULL THEN
b.review
ELSE
b.description
END, 'image', b.image, 'rating', b.rating, 'date', b.date_finished)
ELSE
NULL
END AS feed
FROM
FROM
optimized_books b
UNION ALL
SELECT
UNION ALL
SELECT
m.last_watched AS content_date,
m.title,
m.description,
@ -49,11 +53,15 @@ WITH feed_data AS (
m.rating,
m.tags,
CASE WHEN m.last_watched IS NOT NULL THEN
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.url), 'description', m.description, 'image', m.image, 'rating', m.rating, 'date', m.last_watched)
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.url), 'description', CASE WHEN m.review IS NOT NULL THEN
m.review
ELSE
m.description
END, 'image', m.image, 'rating', m.rating, 'date', m.last_watched)
ELSE
NULL
END AS feed
FROM
FROM
optimized_movies m
)
SELECT

View file

@ -78,7 +78,11 @@ json_build_object('title', CONCAT(b.title, ' by ', b.author), 'image', CONCAT('/
END) AS grid,
CASE WHEN LOWER(b.read_status) = 'finished'
AND b.star_rating IS NOT NULL THEN
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.slug), 'date', b.date_finished, 'description', b.description, 'image', CONCAT('/', df.filename_disk), 'rating', b.star_rating)
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.slug), 'date', b.date_finished, 'description', CASE WHEN b.review IS NOT NULL THEN
b.review
ELSE
b.description
END, 'image', CONCAT('/', df.filename_disk), 'rating', b.star_rating)
ELSE
NULL
END AS feed

View file

@ -83,7 +83,11 @@ WHERE
r.movies_id = m.id) AS related_movies,
CASE WHEN m.star_rating IS NOT NULL
AND m.last_watched IS NOT NULL THEN
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.slug), 'date', m.last_watched, 'description', m.description, 'image', CONCAT('/', df.filename_disk), 'rating', m.star_rating)
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.slug), 'date', m.last_watched, 'description', CASE WHEN m.review IS NOT NULL THEN
m.review
ELSE
m.description
END, 'image', CONCAT('/', df.filename_disk), 'rating', m.star_rating)
ELSE
NULL
END AS feed

View file

@ -45,14 +45,14 @@
<xsl:for-each select="/rss/channel/item">
<div class="item">
<time>Published: <xsl:value-of select="pubDate" /></time>
<h3>
<h2>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link" />
</xsl:attribute>
<xsl:value-of select="title" />
</a>
</h3>
</h2>
<xsl:value-of select="description" disable-output-escaping="yes" />
<xsl:if test="enclosure">
<img class="image-banner" src="{enclosure/@url}" alt="{title}" />

View file

@ -14,7 +14,7 @@
font-size: var(--font-size-sm);
}
& h3 {
& h2 {
margin-top: 0;
}