;; load the Org Mode library to publish to HTML (require 'ox-publish) ;; setup some variables to locate the files we are publish and where (defvar this-dir (file-name-directory (or load-file-name (buffer-file-name)))) (defvar content-dir (concat this-dir "content/")) (defvar public-dir (concat this-dir "public/")) (defun extract-preamble-property (file prop) "Extract some simple PROP from FILE." (with-temp-buffer (insert-file-contents (concat content-dir file)) (goto-char (point-min)) (when (re-search-forward (concat "^#\\+" prop ": *") nil t) (let ((begin (point)) (_ (end-of-line)) (end (point))) (buffer-substring-no-properties begin end))))) (defun page-files () "Make a list of page files." (cons "index.org" (directory-files content-dir nil "^[0-9].*\\.org$"))) (defun navigation (page) "Generate site navigation for PAGE." (let ((current-file (plist-get page :input-buffer))) (concat ""))) ;; the publish configuration (setq org-publish-project-alist `(("pages" :base-directory ,content-dir :base-extension "org" :recursive t :publishing-directory ,public-dir :publishing-function org-html-publish-to-html ;; turn off some features :with-toc nil :section-numbers nil :html-doctype "html5" :html-html5-fancy t :html-head-include-scripts nil :html-head-include-default-style nil :html-head " " :html-preamble navigation :html-postamble ,(with-temp-buffer (insert-file-contents (concat content-dir "postamble.html")) (buffer-string))) ("static" :base-directory ,content-dir :base-extension "css\\|txt\\|jpg\\|gif\\|png\\|svg" :recursive t :publishing-directory ,public-dir :publishing-function org-publish-attachment) ("site" :components ("pages" "static"))))