alexanderlobov - Creating a blog using Hakyll

Creating a blog using Hakyll

Posted on November 6, 2016

This is my new blog and it is created using Hakyll.

I plan to move here my other blogs: and

Steps performed to create this site

Created repository to host the site using Github pages

Created repository to host source code for site generation.

Cloned repository with source code.

Initialized stack and built site.

$ hakyll-init .
$ stack init
$ stack build
$ stack exec site build

If you want to see the result

$ stack exec site watch

Cleaned up stuff that I did not need, tweaked .gitignore.


$ stack exec site clean
$ git add --all
$ git commit -m "Initial commit"
$ git push origin master

Added site repository as a git submodule

git submodule add _site

Build site and commit

stack exec site build
cd _site
git add --all
git commit -m "Update from 01f6054"
git push origin master

Git submodules: to be or not to be

Using git submodules has a disadvantage: if you run clean or rebuild command, _site directory is removed and you need to make extra steps to restore git repository in this directory. I did not found it convenient. So I deleted the submodule and began to use separate working copy of site repository. If you want to deploy site, you need to copy newly generated stuff to this working copy. It is possible to configure “deploy” command for site executable.