From 6efcd03a0fb99fb91c7a58c346b4f9722e1a67bc Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Sun, 14 Apr 2024 20:26:44 -0500 Subject: retry --- publish.el | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/publish.el b/publish.el index 5ada822..7748064 100644 --- a/publish.el +++ b/publish.el @@ -1,11 +1,18 @@ (require 'package) -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(setq package-load-list '((htmlize t))) +(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) -(unless (package-installed-p 'htmlize) +(unless (package-installed-p 'use-package) (package-refresh-contents) - (package-install 'htmlize)) + (package-install 'use-package)) +(eval-and-compile + (setq use-package-always-ensure t + use-package-expand-minimally t)) + +(use-package htmlize) +(use-package org + :ensure org-plus-contrib) (require 'org) (require 'ox-html) @@ -18,6 +25,33 @@ entry (org-publish-find-title entry project))))) +(defun posts-rss-feed (title list) + "Generate a sitemap of posts that is exported as a RSS feed. +TITLE is the title of the RSS feed. LIST is an internal +representation for the files to include. PROJECT is the current +project." + (concat + "#+TITLE: " title "\n\n" + (org-list-to-subtree list))) + + +(defun format-posts-rss-feed-entry (entry _style project) + "Format ENTRY for the posts RSS feed in PROJECT." + (let* ( + (title (org-publish-find-title entry project)) + (link (concat (file-name-sans-extension entry) ".html")) + (pubdate (format-time-string (car org-time-stamp-formats) + (org-publish-find-date entry project)))) + (message pubdate) + (format "%s +:properties: +:rss_permalink: %s +:pubdate: %s +:end:\n" + title + link + pubdate))) + (setq org-publish-project-alist '( ("org-notes" @@ -59,17 +93,22 @@ :sitemap-sort-files anti-chronologically :sitemap-title "Blog") ("org-rss" + :publishing-directory "~/public_html" :base-directory "~/blog/" :base-extension "org" + :exclude "index.org" + :publishing-function publish-posts-rss-feed + :rss-extension "xml" :html-link-home "https://jjanzen.ca" :html-link-use-abs-url t - :rss-extension "xml" - :publishing-directory "~/public_html/rss" - :publishing-function (org-rss-publish-to-rss) - :section-numbers nil - :exclude ".*" - :include ("index.org") - :table-of-contents nil) + :html-link-org-files-as-html t + :auto-sitemap t + :sitemap-function posts-rss-feed + :sitemap-title "Jacob Janzen's Blog" + :sitemap-filename "rss.org" + :sitemap-style list + :sitemap-sort-files anti-chronologically + :sitemap-format-entry format-posts-rss-feed-entry) ("org-config" :base-directory "~/.doom.d/" :base-extension "org" -- cgit v1.2.3