#+TITLE: Static blog with org-mode
#+AUTHOR: Yann Esposito
#+EMAIL: yann.esposito@gmail.com
#+KEYWORDS: programming, blog
[[https://her.esy.fun][her.esy.fun]]
This is a new take on my personal blog.
With a lot more minimalism in mind.
Fully done with [[https://orgmode.org][=org-mode=]].
* Code magic
Here is how I publish this website in emacs using org-mode.
I just eval that code and then do a simple `org-publish` for the blog.
And that's it.
#+begin_src elisp :results none
(require 'org)
(require 'ox-publish)
(require 'ox-html)
(require 'org-element)
(require 'ox-rss)
(defun org-blog-prepare (project-plist)
"With help from `https://github.com/howardabrams/dot-files'.
Touch `index.org' to rebuilt it.
Argument `PROJECT-PLIST' contains information about the current project."
(let* ((base-directory (plist-get project-plist :base-directory))
(buffer (find-file-noselect (expand-file-name "index.org" base-directory) t)))
(with-current-buffer buffer
(set-buffer-modified-p t)
(save-buffer 0))
(kill-buffer buffer)))
(defvar org-blog-head
"
")
(defun org-blog-preamble (_plist)
"Pre-amble for whole blog."
"Programming Heresy")
(defun org-blog-postamble (_plist)
"Post-amble for whole blog."
"
Home -
Posts")
(defun org-blog-sitemap-format-entry (entry _style project)
"Return string for each ENTRY in PROJECT."
(when (s-starts-with-p "posts/" entry)
(format (concat "@@html:"
""
"@@ %s @@html:@@ [[file:%s][%s]] @@html:@@")
(format-time-string "%Y-%m-%d"
(org-publish-find-date entry project))
entry
(org-publish-find-title entry project))))
(defun org-blog-sitemap-function (title list)
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
(concat "#+TITLE: " title "\n\n"
"\n#+begin_archive\n"
(mapconcat (lambda (li)
(format "@@html: