New release: 1.1.0 Added RSS feed generation

The latest 10 posts will be added to the rss.xml file.
This commit is contained in:
Tom
2025-11-21 18:22:22 +01:00
parent 717571deb2
commit b38680dd81
3 changed files with 56 additions and 3 deletions

View File

@@ -7,6 +7,8 @@ This document tracks all notable changes to Whisper Engine.
Source: [[https://github.com/deadswitch404/whisper-engine][Whisper Engine on GitHub]]
Versioning: Follows Semantic Versioning (https://semver.org/)
** <2025-11-21 Fri> - *1.1.0*
- RSS feed generation feature added.
** <2025-11-21 Fri> - *1.0.3*
- CNAME is protected at full site rebuild.
** <2025-09-01 Mon> - *1.0.1*

View File

@@ -26,6 +26,7 @@ From simple org files to static sites. In one Emacs window.
- SHA256-based incremental builds for speed and integrity
- Incremental build ~M-x ds/generate-site~
- Full rebuild: ~C-u M-x ds/generate-site~
- RSS feed generation
** Requirements

View File

@@ -1,6 +1,6 @@
;;
;; Whisper Engine - The Ghost Operator Site Generator
;; v1.0.3
;; v1.1.0
;;
;;; -----------------------------
@@ -43,7 +43,7 @@
(defvar ds/base-html-template
"<!DOCTYPE html>
<html lang=\"en\">
<!-- Generated with Whisper Engine v1.0.3 -->
<!-- Generated with Whisper Engine v1.1.0 -->
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
@@ -217,6 +217,11 @@ Placeholders: title, og-tags, navigation, body-html, footer.")
category
"General"))
(defun ds/rss-date (org-date)
"Sanitize ORG date format for the RSS feed."
(format-time-string "%a, %d %b %Y %H:%M:%S %z"
(org-time-string-to-time org-date)))
;;; -----------------------------
;;; Incremental export
;;; -----------------------------
@@ -332,6 +337,49 @@ Placeholders: title, og-tags, navigation, body-html, footer.")
(with-temp-file filepath
(insert html))))
(defun ds/generate-rss-feed (&optional count)
"Generate RSS feed with the latest COUNT posts (default 10)."
(let* ((posts (cl-subseq (ds/collect-sorted-posts)
0 (min (or count 10)
(length (ds/collect-sorted-posts)))))
(rss-items
(mapconcat
(lambda (meta)
(let* ((title (ds/get-keyword "TITLE" meta))
(teaser (or (ds/get-keyword "TEASER" meta) ""))
(url (format "%s/%s"
ds/site-url
(ds/get-keyword "EXPORT_URL" meta)))
(date (ds/get-keyword "DATE" meta))
(pubDate (ds/rss-date date)))
(format "
<item>
<title>%s</title>
<link>%s</link>
<description><![CDATA[%s]]></description>
<pubDate>%s</pubDate>
<guid>%s</guid>
</item>"
title url teaser pubDate url)))
posts
"\n"))
(rss-xml
(format "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\">
<channel>
<title>The Silent Architect's Whispers</title>
<link>%s</link>
<description>Latest Whispers From The Silent Architect.</description>
%s
</channel>
</rss>"
ds/site-url
rss-items))
(filepath (expand-file-name "rss.xml" ds/public-article-dir)))
(with-temp-file filepath
(insert rss-xml))
(message "[Whisper] RSS feed updated: %s" filepath)))
;;; -----------------------------
;;; Pagination feature
;;; -----------------------------
@@ -492,7 +540,9 @@ Placeholders: title, og-tags, navigation, body-html, footer.")
;; Rebuild category pages
(ds/generate-category-pages sorted-posts)
;; Rebuild categories overview
(ds/generate-categories-page sorted-posts))
(ds/generate-categories-page sorted-posts)
;; Generate RSS feed
(ds/generate-rss-feed))
;; Save updated cache
(ds/save-cache)
(message "[Whisper] Incremental build complete."))