Building the wiki

(Keeping this checked in for posterity, in case I lose my Emacs configuration or whatever.)

I use Denote for my notes. The process of building the wiki website is as follows:

  1. Within Emacs, run M-x org-publish-all. This outputs the HTML files to ~/www/wiki.r.o/site.
  2. Run Soupault to do post-processing and build the wiki index page.
  3. Publish.

Emacs is the main interface for my notes, so I don't keep a web server running unless I'm specifically tweaking the HTML output or stylesheet.

The ox-publish configuration I use is as follows:

(with-eval-after-load 'ox-publish
  (setq org-publish-project-alist nil)
  (push `("wiki.r.o"
          :recursive t
          :base-directory ,(expand-file-name "~/Documents/wiki")
          :publishing-directory ,(expand-file-name "~/www/wiki.r.o/site")
          :publishing-function ,#'org-html-publish-to-html
          :html-validation-link nil
          :html-doctype "html5"
          :html-htmlize-output-type 'inline-css
          :html-self-link-headlines t
          :html-html5-fancy t
          :html-head-include-scripts nil
          :html-head-include-default-style nil
          :html-link-org-files-as-html t
          :html-head "<link rel=\"stylesheet\" href=\"/style.css\" />"
          :html-preamble
          ""
          :html-postamble
          "<footer>
             <div id=\"wiki-index\"></div>
             <p><a href=\"/\">Go home</a> &middot;
               Created on <span class=\"dt-created\">%d</span> &middot;
               Last modified on <span class=\"dt-modified\">%C</span></p>
           </footer>"
          :with-author nil
          :with-creator nil
          :with-toc nil
          :section-numbers nil
          :htmlized-source t
          :time-stamp-file nil)
        org-publish-project-alist))

I've also wrapped this in a few interactive commands for ease of use from within Emacs:

(defun me/wiki-build (arg)
  (interactive "P")
  (org-publish "wiki.r.o" arg)
  (let ((default-directory (expand-file-name "~/www/wiki.r.o"))
        (async-shell-command-display-buffer nil))
    (async-shell-command "just -q build")))

(defun me/wiki-publish ()
  (interactive)
  (me/wiki-build)
  (let ((default-directory (expand-file-name "~/www/wiki.r.o"))
        (async-shell-command-display-buffer nil))
    (async-shell-command "just publish")))