Welcome
Welcome to CMDline.nl - a collection of random posts on open-source related tech.
For years i’ve been dragging a memory file with me everywhere, which can be quickly searched for patterns. Very handy if your brain often decides to hold back information on you.
Working with the very useful Cobra lib for Golang i learnt that Steve Francia aka. spf13 also created a static site generator called Hugo so i decided to give it a go and perhaps store “bits and pieces” here as an extension of my cognitive brain, always at hand. Really surprising how much more efficient and clean writing some new posts is with Hugo, compared to a dynamically generated blog with a DB backend, obviously code that needs to run to render pages as they’re requested and often requiring sh*tloads of plugins to get to anything meaningful (or writing some custom theme/plugin).
Obviously the speed improvement is huge, specially when running on limited resources, and writing a post in Markdown within your favourite editor is just so much better. May create a dedicated post later covering some more advanced topics should they not already be documented, for now here’s how simple it is to get going;
- Start hugo as daemon, it includes an HTTP server:
$ hugo server --buildDrafts --watch
- Alternatively when already running a webserver in front, let it just watch for changes and it will generate html as files:
$ hugo --buildDrafts --watch
| EN
+------------------+----+
Pages | 13
Paginator pages | 0
Non-page files | 0
Static files | 8
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Watching for changes in <your docroot>
Press Ctrl+C to stop
- Create a new post:
$ hugo new posts/welcome.md
- Now edit the post and the hugo process will pick it up faster than one can click to reload a page:
Change detected, rebuilding site
2018-09-08T23:36:41+02:00
Source changed "<your docroot>/content/posts/welcome.md": WRITE
Total in 17 ms
Each post.md
contains a header:
---
title: "Test"
date: 2018-09-09T00:21:36+02:00
draft: true
---
If you want to hide drafts then just ommit --buildDrafts
when starting Hugo.
That’s all there is to it really…
Anyway, this is more or less how this blog got started just now (ツ)