01/7/2020 | Reading time: 3 minutes

Using Archetypes in Hugo

For the longest time I completely ignored archetypes in hugo. I’d always copy over the front-matter from the last blog post I wrote and then fill in the things I needed - leading to some mistakes (e.g. using category instead of categories) over time. Archetypes are easy to use, for example to create this post I ran the following command $ hugo new blog/2020-01-07-using-archetypes-in-hugo.md This copied over the archetype file from archetypes/blog.

View full post
01/6/2020 | Reading time: 1 minute

Hugo aliases and redirects

Using aliases to prevent 404 when restructuring your Hugo site

With the recent redesign and re-structuring of my website I decided to include year and month in URLs. I previously only used the post title as URL key, so a post with title Hello world would be available at kevingimbel.de/hello-world. With the new format this includes the section, year, and month, so for example kevingimbel.de/blog/2020/01/hello-world. To prevent all old URLs from failing with a 404 I added aliases to all old posts.

View full post
01/3/2020 | Reading time: 1 minute

Hugo: ignore _index.md in list templates

How I ignore _index.md files in my list templates

While creating my new website I also added more sections, namely a blog, photography, and art section. All of these use list templates and render “article”-like content previews. I wanted to add some content to these lists and Hugo has a special file named _index.md for that. This file can be used to create index pages for lists. When I did that I somehow also included the index files in the post listings which was not what I wanted, so I added a if statement to my article-preview.

View full post
01/2/2020 | Reading time: 2 minutes

Hugo: compare dates to flag old content

How I use Math and Date functions to flag old posts in Hugo

With the recent redesign of my website I also wanted to add a note to old articles. The IT world is changing fast and information can quickly be outdated, so I decided to add an automatically generated note to every post that is older than 4 years. Using the Hugo Math function and Date values it can be accomplished in automated-enough fashion. Partial First I created a new partial named single-header.

View full post
09/12/2018 | Reading time: 1 minute

Mastodon Embed Shortcode for hugo

You may know that I made some shortcodes for Hugo, the static site generator I am using to create this website. So far I made a shortcode for caniuse.com and codepen.io which allow to embed CodePen and “Can I Use” embeds easily with Hugos build-in Shortcode system. Today I made another one which allows embeds from Mastodon, the decentralized Twitter-like social network. An example embed is shown below. The Source Code can be found on GitHub.

View full post
01/17/2017 | Reading time: 8 minutes

Deploy a static site with git

If you follow my blog you might recall that I switched from Jekyll hosted on GitHub to Hugo hosted on Uberspace. Beside the fact I had to create a custom Hugo theme for myself and learn how to run a Hugo blog/website I also had to think about how I am going to deploy my website. Hugo is a static site generator and when executed ($ hugo) it compiles the site from Markdown and HTML templates into a public directory with lots of folders and HTML files.

View full post
11/16/2016 | Reading time: 3 minutes

Farewell Jekyll, Hello Hugo

If you have visited my website in the past few weeks you might have notices a few things. First of all it looks different. Second, it is now served over HTTPS which is possible because I moved away from GitHub Pages and back to self-hosting my website. Third, and possible most important, I also moved away from Jekyll after using it for three years. This very site you read right now is build with Hugo, a static site generator build by Steve Francia, Bjørn Erik Pedersen and a lot of contributors.

View full post