Blogging with org-mode for good
I've adapted much of the configuration provided by Thomas Ingram in Building a Emacs Org-Mode Blog so as to manage my blog posts.
FWIW some useful configuration bits (style may be improved):
(setq org-publish-project-alist '( ("publicwebsite" ;; ... ) ("publicwebsiteblog" ;; ... :sitemap-title "Blog Posts" :sitemap-filename "index.org" :sitemap-sort-files anti-chronologically :sitemap-format-entry (lambda (entry style project) "Format ENTRY in org-publish PROJECT Sitemap format ENTRY ENTRY STYLE format that includes date." (let ((filename (org-publish-find-title entry project))) (if (= (length filename) 0) (format "*%s*" entry) (format "{{{timestamp(%s)}}} [[file:%s][%s]]" (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)) entry filename)))) ; HTML5 :html-doctype "html5" :html-html5-fancy t :exclude "settings.org\\|blogheaders.org" :sitemap-function (lambda (title sitemap) "Prepend pages headers before the posts list" (let* ((title "Blog posts") (subtitle "Posts") (posts (cdr sitemap)) ) (concat (format "#+TITLE: %s\n\n" title) "\n#+SETUPFILE: ./settings.org\n\n" "\n#+OPTIONS: toc:nil\n\n" "\n#+INCLUDE: ./blogheaders.org\n" (format "\n* %s\n" subtitle) (org-list-to-org (cons (car sitemap) posts)) ) )) ) ;; ...
Here, you'll notice an example of an inline lambda in the
sitemap-format-entry
, instead of having to define a function name as
Thomas did… YMMV.
Also, as I want the blog posts index to be generated with the same
presentation as the rest of the blog pages, I need it to contain the
following header in the generated index.org
sitemap file for that blog
section:
#+TITLE: Blog posts #+SETUPFILE: ./settings.org #+OPTIONS: toc:nil #+INCLUDE: ./blogheaders.org ...
So, I've added a sitemap-function
, taking inspiration from what Duncan
Mac-Vicar P. is doing in duncan/archive-sitemap-function
(see
http://www.mac-vicar.eu/posts/2019-09-03-migrating-from-jekyll-to-org/index.html).