published on 26.07.2020

This post contains nothing but notes that I took while experimenting Hugo templates. To understand each page and it’s variables (properties) I’ve created a partial called hugo_debug.html and used it in baseof.html, simply by adding this line: {{ partial "hugo_debug.html" . }}

<div>
Title: {{.Title}} <br>
Kind: {{.Kind}} <br>
Section: {{.Section}} <br>
Type: {{.Type}} <br>
Layout: {{.Layout}}<br>
Site Author: {{.Site.Author.FullName}}<br>
Author: {{ .Params.Author }} <br>
Categories: {{ .Params.Categories }} <br>
Date: {{.Date.Format "2006-01-02 Monday"}}<br>
Params: {{.Params}}<br>
</div>

Section vs Type

  • Section is the first folder under content (content/blog => blog)
  • Section cannot be set in front matter
  • Type can be set in front matter
  • If Type isn’t set, the value of Section will be used

Example: for a file named “foo” from a section called “posts”.

/content/post/foo.md
Type: post
Section: post
Kind: page

Example: for a file named “bar” from a section called “foo”.

/content/foo/bar.md
Type: foo
Section: foo
Kind: page

Section Pages

Section pages are the index pages or home pages for that section. These pages are created auto-magically by Hugo and we can overwrite them by simply creating a file called _index.md in that section.

/content/foo/
Type: foo
Section: foo
Kind: section

Ordinary Pages (about.md)

/content/about.md

Normally, these pages have the following properties. Yet, I set Type: ordinary to be able to separate them from normal blog posts while listing content with Hugo templates. Explained here

Type: page
Section:
Kind: page

Taxonomy

Hugo lets us group content with taxonomies.

/categories
Type: categories
Section: categories
Kind: taxonomy

Term

/categories/foo
Type: categories
Section: categories
Kind: term
You are reading the 2nd of 19 episodes in Hugo.
Published on 26.07.2020 by Mert Bakır with commit db8d56a.
hugo
#hugo #static-site
Next episode:
Hugo Templates: This is My Design
published on 03.08.2020

In this post, I aim to explain this website. Template by template… The main purpose here is to create a document to myself for future reference. Templates are complicated and not easy to read. That’s why I’ll probably forget what I did and why I coded this way. […] We are …

published on 21.08.2020

“Overwriting default landing page for Hugo taxonomies”. What do I mean by that? By default, Hugo will create a home page or a landing page for your taxonomies. /tags/ or /categories are good examples. If you don’t have any specific templates for tags /layouts/tags/list.html Hugo …

published on 05.08.2020

This post will be very short and precise. In Jekyll, we had to create an .xml file using liquid templates to tell Jekyll that we want an rss.xml or similarly sitemap.xml. Luckily, Hugo creates these files for us under the hood. You can check them by going to /index.xml and /sitemap.xml pages in your …

published on 10.07.2022

Previously, I’ve published a blog post about deploying static content on heroku with basic authentication. The main purpose was to get basic auth for a freely hosted static website. In that post, we hosted the source code on GitLab and configured a CI/CD pipeline to render the static content …

published on 28.05.2022

Each git commit has a field called Author which consists ‘user.name’ and ‘user.email’. We usually set these variables once, after installing git, with git config --global so that each repo gets the variables from the global definition. We can also set them locally for a …

published on 25.05.2022

In this post, I’ll first walk through hosting static content with basic authentication. Then, we’ll look into deploying to Heroku using GitLab Pipelines, more specifically deploying a certain sub-directory within the project instead of pushing the whole project. Also, I’ll share …

published on 17.04.2022
edited on 15.07.2022

Önceki bölümde, markdown formatını LaTeX formatına dönüştürmek için kullanılan Pandoc yazılımından bahsetmiştik. Şimdi konuyu bir adım daha ileri taşıyıp ve bookdown’a geçiyoruz. Bookdown; Rmarkdown kullanarak teknik dökümanlar, kitaplar yazabilmemizi sağlayan, Yihui Xie tarafından yazılmış …

published on 10.04.2022

I’ve been using WSL-2 on Windows for over a year. It’s very useful because some Python packages are just a headache to install on Windows. Also, docker. It’s just better on Linux. Yet, WSL-2 can also be problematic. I remember trying a dual-boot setup when things just went way too …

published on 03.03.2022

In this post, I’ll share how to install geopandas and some other gis related packages on Windows. If you are on Mac or Linux you can probably just pip install those without any issue. I usually had to do a google search every time I wanted to install these packages on Windows environment. Of …