As part of my daily habit, I keep and write notes that contain ideas, thoughts and exploratory pieces. These notes, however, are not well maintained and hence they are not as useful for myself or for others as they can be. I think it would be great if these notes can be polished and made available online.
Currently my personal site is made with Jekyll, which is a really powerful framework for generating static site from markdown documents. What is truly useful for me, who uses emacs and org-mode for all of my notes, is that one can generate markdown documents from org files very easily.
Hugo is another framework for creating static site, that just happens to have a working org notes to blog posts open-source implementation. ox-hugo can be used to generate new blog posts in hugo-style markdown. The concept is quite simple. The org files are first exported to markdown files. Then hugo builds the html site from these markdown files, which is then deployed using Github pages.
To preview a site made with hugo, one simply do
cd ~/org/publish && hugo serve
This starts a server publishing the built site locally, with auto-refresh and other goodies. Very pleasant to work with.
Now I have gave Hugo a try. In the end, I couldn’t really find a configuration that I am happy with. So back to jekyll I am.
Generating markdown posts from org files
For each org note that is to be published, fill in the front matter as
shown below. When satisfied with the note, use
org-export (C-c C-e H
h) to generate the markdown post. After doing this, there should be a
new mardown file exported to the jekyll
_posts folder with the same
name as the org file but in markdown format.
#+TITLE: Transforming note to blog posts #+HUGO_SECTION: posts #+HUGO_CATEGORIES: blog hugo #+HUGO_BASE_DIR: publish #+DATE: 2020-06-12 #+toc: headlines 2
Alternatively, include the setup file:
#+TITLE: Multi-view geometry in Robotics #+setupfile: ./hugo-setup.org #+DATE: 2020-07-31 #+toc: headlines 2
I actually use my own fork of ox-hugo to do this generation because I actually want it to work with jekyll. See the fork here.
Using pandoc and pandoc-citeproc can be used to generate citation. The org file need to define a bibtex file
#+hugo_pandoc_citations: t #+bibliography: test.bib
To cite an article, use the below syntax. This is how a citation looks like: Illingworth and Kittler (1988). And this is the verbatim source code.