summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2026-06-11 20:21:53 -0700
committerKleidi Bujari <mail@4kb.net>2026-06-11 20:21:53 -0700
commitc70ed97035ed9fee92a400827db5abd59d1ad4a3 (patch)
treefe13554007e1737e121899a855bd6b2af49a651a
parentd0c828468ab88a6c4faeec23b1b217a64467303f (diff)
download.emacs.d-c70ed97035ed9fee92a400827db5abd59d1ad4a3.tar.gz
.emacs.d-c70ed97035ed9fee92a400827db5abd59d1ad4a3.tar.bz2
.emacs.d-c70ed97035ed9fee92a400827db5abd59d1ad4a3.zip
define lib for building the kleidi.ca site
-rw-r--r--lisp/kleidi-ca.el100
1 files changed, 100 insertions, 0 deletions
diff --git a/lisp/kleidi-ca.el b/lisp/kleidi-ca.el
new file mode 100644
index 0000000..cfe2573
--- /dev/null
+++ b/lisp/kleidi-ca.el
@@ -0,0 +1,100 @@
+(require 'xmlgen)
+(require 'ox-publish)
+
+(setopt org-export-global-macros '(("timestamp" . "@@html:<br/><time id=\"posted\">$1</time>@@"))
+ org-html-htmlize-output-type nil)
+
+(defun blog/org-publish-sitemap-default-entry (entry style project)
+ (cond ((not (directory-name-p entry))
+ (format "[[file:%s][%s]] {{{timestamp(%s)}}}"
+ entry
+ (org-publish-find-title entry project)
+ (format-time-string "%B %d\\, %Y"
+ (org-publish-find-date entry project))))
+ ((eq style 'tree)
+ (file-name-nondirectory (directory-file-name entry)))
+ (t entry)))
+
+(defconst kleidi-ca-header
+ (xmlgen
+ '(header :style "margin: 3em 0 3em 0; display: flex; gap: 8px; flex-direction: column; font-family: monospace"
+ (span "Kleidi Bujari <" (a :href "mailto:mail@4kb.net" "mail@4kb.net") ">")
+ (nav :style "display: flex; gap: 8px"
+ (span (a :href "/" "kleidi.ca" ) " |")
+ (a :href "/about.html" "about")
+ (a :href "/posts/" "posts")
+ (a :href "/reviews" "paper reviews")
+ (a :href "https://github.com/kbujari" :target "_blank" "github"))))
+ "Common <header> compononent that should appear on most HTML pages")
+
+(defconst kleidi-ca-statics
+ (concat (xmlgen '(link :rel "icon" :href "/favicon.ico" :type "image/x-icon"))
+ "\n"
+ (xmlgen '(link :rel "stylesheet" :href "/main.css" :type "text/css"))))
+
+(setopt org-publish-project-alist
+ `(("orgfiles"
+ :base-directory "~/org"
+ :include ("index.org" "about.org")
+ :publishing-directory "~/public_html"
+ :recursive nil
+ :section-numbers nil
+ :with-toc nil
+
+ ;; :auto-sitemap t
+ ;; :sitemap-filename "index.org"
+ ;; :sitemap-title ""
+ ;; :sitemap-format-entry blog/org-publish-sitemap-default-entry
+ ;; :sitemap-sort-files anti-chronologically
+ ;; :sitemap-function blog/sitemap-function
+
+ :html-head nil
+ :html-head-extra ,kleidi-ca-statics
+ :html-head-include-scripts nil
+ :html-head-include-default-style nil
+ :html-postamble nil
+ :html-preamble ,kleidi-ca-header)
+
+ ("posts"
+ :base-directory "~/org/posts"
+ :base-extension "org"
+ :publishing-directory "~/public_html/posts"
+ :section-numbers nil
+ :with-toc nil
+ :auto-sitemap t
+ :recursive t
+ :sitemap-sort-files anti-chronologically
+ ;; :sitemap-function blog/sitemap-function
+ :sitemap-format-entry blog/org-publish-sitemap-default-entry
+ :sitemap-title "Posts"
+ :sitemap-filename "index.org"
+ :sitemap-style list
+ :html-head nil
+ :html-head-extra ,kleidi-ca-statics
+ :html-head-include-scripts nil
+ :html-head-include-default-style nil
+ :html-postamble nil
+ :html-preamble ,kleidi-ca-header)
+
+ ("css"
+ :base-directory "~/org"
+ :base-extension "css\\|png\\|ico"
+ :publishing-directory "~/public_html"
+ :recursive t
+ :publishing-function org-publish-attachment)
+ ("kleidi.ca" :components ("orgfiles" "posts" "css"))))
+
+(defun make-kleidi-ca ()
+ "Build kleidi.ca site and publish to public_html/"
+ (interactive)
+ (require 'ox-publish)
+ (org-publish "kleidi.ca" t))
+
+(defun kleidi-ca/compile ()
+ "Live preview of published kleidi.ca site in public_html/"
+ (interactive)
+ (compile "nix run nixpkgs#python3 -- -m http.server 8080 --bind 0.0.0.0 --directory ~/public_html"))
+
+(keymap-global-set "C-x C-/" 'make-kleidi-ca)
+
+(provide 'kleidi-ca)