Skip to content

Commit 850d65d

Browse files
committed
WIP: Add guide chapters SQL union to newsletter template
Adds blog_chapter query to the content CTE in the newsletter SQL. Still needs: URL handling in collected CTE, JS rendering with first-3-paragraph truncation and [... word count] suffix, chapter state management, and extras count integration. https://claude.ai/code/session_01Df7tNiUDSXVwvF1yeChynr
1 parent cfc038f commit 850d65d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

blog-to-newsletter.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,26 @@ <h2>Links sent in previous newsletters</h2>
542542
'' as external_url
543543
from blog_note
544544
union all
545+
select
546+
c.id,
547+
'chapter' as type,
548+
c.title,
549+
c.created,
550+
c.slug,
551+
'No HTML' as html,
552+
json_object(
553+
'created', date(c.created),
554+
'title', c.title,
555+
'body', c.body,
556+
'chapter_slug', c.slug,
557+
'guide_title', g.title,
558+
'guide_slug', g.slug
559+
) as json,
560+
'https://simonwillison.net/guides/' || g.slug || '/' || c.slug || '/' as external_url
561+
from blog_chapter c
562+
join blog_guide g on c.guide_id = g.id
563+
where c.is_draft = 0
564+
union all
545565
select
546566
rowid,
547567
'til' as type,

0 commit comments

Comments
 (0)