From 0921964e91709d8dd454235753c4554cdee3f7eb Mon Sep 17 00:00:00 2001 From: azureazure Date: Wed, 31 Dec 2025 21:57:35 +0100 Subject: actually write something for once --- build-site.el | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'build-site.el') diff --git a/build-site.el b/build-site.el index b834312..f4587c7 100644 --- a/build-site.el +++ b/build-site.el @@ -7,12 +7,11 @@ org-html-doctype "html5" org-html-html5-fancy t org-html-head-include-default-style nil - ;; org-html-postamble nil org-html-head (with-temp-buffer (insert-file-contents "head.html") (buffer-string))) -(defun custom/sitemap-format-entry (entry style project) +(defun my/sitemap-format-entry (entry style project) (let ((filename (org-publish-find-title entry project)) (date (org-publish-find-date entry project))) (format "%s - [[file:%s][%s]]" @@ -20,7 +19,12 @@ entry filename))) -(defun custom/body-query (html-file &optional url with-toc) +(defun my/sitemap-function (title list) ; todo change this + (org-publish-sitemap-default title list)) + +(defun my/body-query (html-file &optional _url _with-toc) + "Replaces the tag in the RSS output with the contents of . +Arguments beginning with _ are required for the function to work but are unused." (with-temp-buffer (insert-file-contents html-file) (let* ((dom (libxml-parse-html-region (point-min) (point-max))) @@ -31,12 +35,25 @@ (setq org-publish-project-alist (list + (list "blog" + :recursive t + :base-directory "./src/blog" + :publishing-directory "./public/blog" + :publishing-function 'org-html-publish-to-html + :section-numbers nil + :with-toc nil + :auto-sitemap t + :time-stamp-file nil + :sitemap-title "Lemurblog" + :sitemap-filename "index.org" + :sitemap-sort-files 'anti-chronologically + :sitemap-format-entry 'my/sitemap-format-entry + :sitemap-function 'my/sitemap-function) (list "pages" :recursive nil :base-directory "./src" :publishing-function 'org-html-publish-to-html :publishing-directory "./public" - ;; :with-title nil :with-toc nil :html-postamble nil :section-numbers nil @@ -46,34 +63,24 @@ :base-directory "./src/assets" :base-extension 'any :publishing-function 'org-publish-attachment - :publishing-directory "./public/assets") - (list "blog" - :recursive t - :base-directory "./src/blog" - :publishing-directory "./public/blog" - :publishing-function 'org-html-publish-to-html - :section-numbers nil - :with-toc nil - :auto-sitemap t - :time-stamp-file nil - :sitemap-title "Blog posts" - :sitemap-filename "index.org" - :sitemap-sort-files 'anti-chronologically - :sitemap-format-entry 'custom/sitemap-format-entry))) + :publishing-directory "./public/assets"))) (delete-directory "public" :recursive t) (org-publish-all t) -(let ((webfeeder-body-function 'custom/body-query)) +(let ((webfeeder-body-function 'my/body-query)) + (setenv "TZ" "UTC0") ; remove the timezone from webfeeder output (webfeeder-build "rss.xml" "./public/blog" "https://lemurianmage.srht.site" (seq-filter (lambda (x) (not (or (file-directory-p x) (string= x "index.html")))) - (directory-files "public/blog")) ; no ".", "..", and index.html - :title "lemurblog" + (directory-files "public/blog")) ; no ".", "..", and index.html + :author "The Lemurian Mage" + :title "Lemurblog" + :generator "The Lemurian Mage's Little Lemur Hands" :builder 'webfeeder-make-rss :build-date 0)) -- cgit v1.2.3