Emacs Log 1: This Blog

WARNING: This blog post is still under construction!

This blog is built on top of org-mode!

Appendix A: config.el snippet

(require 'ox-publish)

;; Get project settings
(defun akko/blog-spec ()
  "Return project settings for use with `org-publish-project-alist'."
  (let* ((get-util (lambda (x)
                     (with-temp-buffer
                       (insert-file-contents (concat "~/Blog/util/"
                                                     x))
                       (buffer-string))))
         (html-head (funcall get-util "head.html"))
         (html-preamble (funcall get-util "preamble.html"))
         (html-postamble (funcall get-util "postamble.html")))
    `(
      ("pages"
       :base-directory "~/Blog/org"
       :base-extension "org"
       :recursive t
       :publishing-directory "~/Blog/html"
       :publishing-function org-html-publish-to-html

       :html-doctype "html5"
       :html-html5-fancy t

       :html-viewport ((width "100%")
                       (initial-scale "0.7")
                       (minimum-scale "")
                       (maximum-scale "")
                       (user-scalable ""))

       :language "en"
       :section-numbers nil

       :with-toc nil
       :with-date nil
       :with-title nil
       :with-author nil

       :auto-sitemap t

       :sitemap-sort-files anti-chronologically
       :sitemap-format-entry
       (lambda (entry style project)
         (cond ((not (directory-name-p entry))
                (format
                 "[[file:%s][%s]]\n"
                 entry
                 (org-publish-find-title entry project)))
               ((eq style 'tree)
                (capitalize (file-name-nondirectory (directory-file-name entry))))
               (t entry)))

       :headline-levels 4
       :html-head ,html-head

       :html-preamble ,html-preamble
       :html-postamble ,html-postamble)

      ("static"
       :base-directory "~/Blog/static"
       :base-extension "css\\|txt\\|jpg\\|gif\\|png"
       :recursive t
       :publishing-directory  "~/Blog/html/static"
       :publishing-function org-publish-attachment)

      ("blog" :components ("pages" "static")))))

(setq org-publish-project-alist (akko/blog-spec))

(defun akko/publish-blog ()
  (interactive)
  (setq org-publish-project-alist (akko/blog-spec))
  (org-publish-all))

(defun akko/force-publish-blog ()
  (interactive)
  (setq org-publish-project-alist (akko/blog-spec))
  (org-publish-remove-all-timestamps)
  (org-publish-all))