(package-initialize) (require 'ox-publish) (require 'webfeeder) (setq org-html-validation-link nil org-html-head-include-scripts nil 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) (let ((filename (org-publish-find-title entry project)) (date (org-publish-find-date entry project))) (format "%s - [[file:%s][%s]]" (format-time-string "%F" date) entry filename))) (defun custom/body-query (html-file &optional url with-toc) (with-temp-buffer (insert-file-contents html-file) (let* ((dom (libxml-parse-html-region (point-min) (point-max))) (meta-tags (dom-by-tag dom 'meta))) (cl-loop for (_meta ((_ . name-value) (_ . content-value))) in meta-tags when (string= name-value "description") return content-value)))) (setq org-publish-project-alist (list (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 :time-stamp-file nil) (list "assets" :recursive t :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))) (delete-directory "public" :recursive t) (org-publish-all t) (let ((webfeeder-body-function 'custom/body-query)) (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" :builder 'webfeeder-make-rss :build-date 0)) (message "Build done!")