What is Front Matter
Front matter allows you to change the characteristics of a page through manipulation of the metadata of the website.
All the Hugo front matter fields can be found here; the following list are the ones most used in this project:
---
title: "Default"
date: 2017-10-10T00:54:19+02:00
draft: true
description: "Fiddling around with Front Matter."
thumbnail: "/path_to/image.png"
categories: [
"documentation",
]
tags: [
"markdown",
"hugo",
"frontmatter",
]
disable_comments: true
---
date
doesn’t necessary need the time, it can be omitted. categories
& tags
are classics used to group content based on a limited set of categories and different recurring tags. To spice things up use an image (although there’s no way controlling appearance and size) with the thumbnail
field. Put static content in the static
folder; it will be processed as if it was under the root.
For Google Analytics, put the google***.html file in the
static
folder and it will show up nicely in the root of your website. Create some additional folders to put structure in there, i.e. for images you might envision a separate folder calledimg
which is then accessible via/img/
.
There are several date fields that allow for publishing and unpublishing without the need
to actually remove the content. expiryDate
& publishDate
are self-explanatory.
Some user-defined fields are handy like the disable_comments
field which disables the Disqus integration for that specific page. There’s also a main
field that forces a menu item in the theme’s menu bar. Use within the main
field an additional field name
to change the entry on the menu bar to that string.
menu:
main:
name: This is the menu title
For navigation, there’s prev
and next
to control the order of the pages (and not
based on the date
metadata).