Static web pages in Hugo

on January 24, 2018. in Blablabla, Software. A 2 minute read.

Last week I created a page on this site that holds all the talks I have prepared for meetups and conferences. As this site is powered by Hugo, the process wasn’t that straightforward. I want to write down the steps I did to make it easier in the future.

Oh, and when I say “static” in the title of this post, I mean pages whose content is not completely powered by a markdown content file.

I have tried different approaches, but what ended up working is the following.

In the configuration file, I added a new type of permalink:

    talks = "/talks/"

I created a new type of an archetype under the archetypes directory of my theme:

draft = false
date = {{ .Date }}
title = "{{ replace .TranslationBaseName "-" " " | title }}"

I have also created a new template file for that talks type, which actually has all the content I want to display, but is also capable of using the partials I have created before:

{{ partial "header.html" . }}
<div class="post">
<div class="column">
    {{ partial "sidebar.html" . }}
{{ partial "footer.html" . }}

And finally create a markdown file for it with hugo new talks/, leaving it as is.

Happy hackin’!

Tags: hugo, blog, talks.

Get the next article to your inbox

If you'd like, you can get the next article I write to your email inbox.