about summary refs log tree commit diff
path: root/blog.el
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-11-12T23·57+0100
committerVincent Ambo <tazjin@gmail.com>2017-11-12T23·57+0100
commit040c3487805be38e013934fddf17ec86b5bd7a89 (patch)
tree945d2862fba4bd5baa1e7158eae3d5d8816a538b /blog.el
parentb4dad1526d7a68ca089a22bf01fffa65abc9c5d9 (diff)
feat(blog): Configure org-mode's HTML export to match blog theme
This gets elblog close, but not quite there, to my previous blog
theme.

Comparison screenshot: http://i.imgur.com/UK49Fhi.png
Diffstat (limited to 'blog.el')
-rw-r--r--blog.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/blog.el b/blog.el
index 20f141fe41a5..accfda07888d 100644
--- a/blog.el
+++ b/blog.el
@@ -20,6 +20,17 @@
   :group 'elblog
   :type 'string)
 
+;; org-mode settings need to be configured a certain way for elblog's HTML
+;; templating to work correctly.
+(defun configure-org-html-export ()
+  (setq org-html-postamble t)
+  (setq org-html-doctype "html5")
+  (setq org-html-head-include-scripts nil)
+  (setq org-html-style-default (f-read-text "blog.css"))
+  (setq org-html-preamble-format
+        '(("en" "<header><h1><a class=\"unstyled-link\" href=\"/\">Tazjin&#39;s blog</a></h1><hr></header>")))
+  (setq org-html-postamble-format `(("en" ,(f-read-text "postamble.html")))))
+
 ;; Article fetching & rendering functions
 
 (defun render-org-buffer (buffer &optional force)
@@ -46,7 +57,7 @@
 
 (defun render-article (article)
   "Renders an article, if it exists."
-  (let ((output-buffer (render-org-buffer (concat article ".org"))))
+  (let ((output-buffer (render-org-buffer (concat article ".org") t)))
     (if output-buffer `(200 . ,(get-buffer-string output-buffer))
       article-not-found)))
 
@@ -66,6 +77,7 @@
 
 (defun start-elblog ()
   (interactive)
+  (configure-org-html-export)
   (elnode-start 'elblog-handler
               :port elblog-port
               :host elblog-host))