Blog with pandoc and markdown

I always wanted to have my own ’lil corner on the net, with some sort of blog to share things with. After messing around for so long, I finally switched to this super simple solution, kinda like suckless did.

I keep all the files in my ~/docs/blog directory:

├── assets
│   └── css
│       └── style.css
├── content
│   └──
├── partials
│   ├── footer.html
│   └── header.html
├── templates
│   └── default.html5
└── index.html

Everytime I wanna change something, I run the script and all files will be generated again and again. Also I’m lazy, so I don’t want to set a document title, but just use the level one heading.

cd "$HOME/docs/blog"

for f in content/*.md; do
    pandoc -s -f markdown -t html5 \
           -c assets/css/style.css -B partials/header.html -A partials/footer.html \
           --data-dir=. --metadata title="$(cat $f | head -n1 | cut -c 3-)"  $f -o $(basename $f .md).html

rsync -av . koell:~/html/

Rsync will upload everything to uberspace then.