writing blog posts in emacs

Anyways now that I make making blogposts anyways I guess it would be a nice thing to share how I generate blog posts from emacs.

Now before I do I think it's pretty important to note that my workflow is a bit more manual than it could be, I VERY MUCH could just write some more elisp functions that automate moving the generated html file, adding it to git, commiting the changes and pushing it to the site. But that is for a different 3am insomnia session.

To get started, view the following emacs-lisp code

(setq org-html-head-include-default-style nil)
(setq org-html-head
      (concat
       "<style type=\"text/css\">\n"
       "<!--/*--><![CDATA[/*><!--*/\n"
       (with-temp-buffer
         (insert-file-contents (expand-file-name "~/.config/emacs/style.css"))
         (buffer-string))
       "/*]]>*/-->\n"
       "</style>\n"))

these 2 s-expressions will

  1. disable the default html stylesheet
  2. insert our own stylesheed in the head of our exported html file

now we refer to ~/.config/emacs/style.css, meaning we need to make this ourselves. I personally reccomend running org export html once without the above code snippet in your init file, opening that html file, and copying the style block over to a style.css file, which u can then edit to fit whatever it is you wan't to create.

But that is about it, it's a very simple process, now I can export my org mode documents with C-c C-e, as html with ho or hh, and finally add them to my blogposts. Now you could definitelly automate this. While I won't go into detail for now as I have not set it up myself yet, I think you could rather easily grab the org buffers name, swap out the .org prefix with .html to obtain the path to the newly generated file, and the run an elisp function to move it, rename, generate a new index page and the git add, commit and push. But I will update this blog if I ever come to that.

Ty for reading <3

Created: 2026-07-08 Wed 01:16