(require 'xmlgen) (require 'ox-publish) (setopt org-export-global-macros '(("timestamp" . "@@html:
@@")) 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
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)