Starting through

March 1, 2018

Introduction

In my (now 3 years) time as a full-time web-developer I had always a lot of questions and got so much help from blogs and from stackoverflow. It is so nice to find a quick answer if you can define the question. Now it’s time to give something back to the community. Here I’ll post stuff where I haven’t found answers quickly, things which could be of help for other developers in their daily life and things which are for me and for improving my skills in writing and designing.

Blog-Software

There are many ways to put informations on a website. Wikipedia lists 81 Pages in category Blog-software.

I have tried:

  • Wordpress, the most common CMS on the web, written in php.
  • Sculpin, a static site-generator, written in php.
  • Jenkyll, a ruby-based static site-generator.
  • Hugo, a go-based static site-generator.

Hugo to the rescue

Finally I got some things done.

Example image

Installation

ParallelsVM vs. running locally

As I’m running a MacOs, some applications are running safer and faster on a Debian VM, running in a parallels-container.

Some drawbacks running hugo on a Debian VM:

  • the latest version for Debian Jessie is v0.25.1 (today we are with v.0.37.1)
  • you have to bind the server to the specific URL (/etc/host - settings on the host machine)

So I decided to run it on the local machine with MacOS

Installing hugo on MacOs

$ brew install hugo

Show the version

$ hugo version
Hugo Static Site Generator v0.37.1 darwin/amd64 BuildDate:

Create a new website

$ hugo new site blog

Add a theme

There a plenty of great themes available and listed on https://themes.gohugo.io/.
I have chosen the coder-theme developed by Luiz F. A. de Prá.

Add the selected theme, directly cloning it from github into the themes-folder

$ cd blog
$ git clone https://github.com/luizdepra/hugo-coder.git themes/coder

Copy and adapt the main configuration-file from the repository

$ cp themes/coder/exampleSite/config.toml .

Create a new post

$ hugo new posts/my-first-post.md

Run a dev-server

$ hugo server -D
                   | EN
+------------------+----+
  Pages            | 11
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  8
  Processed images |  0
  Aliases          |  3
  Sitemaps         |  1
  Cleaned          |  0

Total in 23 ms
Watching for changes in /Users/Ralf/Projekte/hugo/blog/{content,data,layouts,static,themes}
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:62029/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Deploy the website

I have added a deploy-script.

#!/bin/sh
hugo
rsync -avz ./public/ root@blog.rabbl.de:/var/www/blog/

Running the script

$ ./deploy.sh

                   | EN
+------------------+----+
  Pages            | 11
  Paginator pages  |  0
  Non-page files   |  1
  Static files     |  7
  Processed images |  0
  Aliases          |  3
  Sitemaps         |  1
  Cleaned          |  0

Total in 27 ms
building file list ... done
404.html
index.html
index.xml
post
sitemap.xml
categories/index.html
categories/index.xml
categories/page/1/index.html
posts/index.html
posts/index.xml
posts/moving-wordpress-to-docker/index.html
posts/page/1/index.html
posts/starting-through/index.html
tags/index.html
tags/index.xml
tags/page/1/index.html

sent 1922 bytes  received 756 bytes  1785.33 bytes/sec
total size is 90695  speedup is 33.87