Skip to content

Configuration

Christian Olsen edited this page Oct 29, 2024 · 7 revisions

All configuration is done in the four configuration files under config/_default/. The URL and site title can be set in hugo.yaml. The navbar settings are set in menus.yaml. All other parameters are set in params.yaml.

hugo.yaml

The hugo.yaml file holds the main configuration for the theme. Here you can set the baseURL and the title. The baseURL is important to set correctly as the css won't be loaded correctly otherwise.

The rest of the settings in hugo.yaml are less important and can be left as default. Both the taxonomy and term kinds are disabled in order to keep the theme minimal. Enabling them won't work as expected, unless templates are added.

Web crawlers and LLM

The enableRobotsTXT setting creates a robots.txt file that are used by web crawlers. The default robots.txt file created will allow crawlers to all pages on the site. This can be changed by overwriting the default template. Add a file ./layouts/robots.txt to your own site repo to overwrite the default one. To deny access to all pages use the following:

User-agent: *
{{ range .Pages }}
  Disallow: {{ .RelPermalink }}
{{ end }}

A default disallow file for using your site for LLM training is also added to the site by default. This file can also be overwritten by added a file ./static/ai.txt to your repo. To allow all use the following:

User-agent: *
allow: *
allow: /

menus.yaml

This configuration file defines the menu items in the navigation bar at the top of the site. The defaults are:

main:
- name: Home
  url: /
  weight: 10
- name: Blog
  url: /blog/
  weight: 20
- name: About
  url: /about/
  weight: 30

Every item in the list defines a new menu item. The url should be relative to the main url, i.e. the blog can be published at https://example.com/blog/. The weight parameter defines the order of the menu items, ordered from smaller to larger.

The urls are closely linked to the folder and file names in the content folder. The /about/ relative url will point hugo to a file called about.md in the content folder. If you change the url, you must also change the file name in order to keep everything working. The same goes for the blog. Because this is a collection of files the link points to the folder. The folder name must be the same as the relative url, i.e. changing the url to /post/ requires changing the folder name to post as well.

params.yaml

This file holds all the configuration for the homepage. The author section defines the stuff related to the round image, text and emoji at the center of the homepage layout. Only the name and image are non-optional, commenting or removing the other keys will remove the greeting text and the emoji. A new image can be used by placing a file in the assets folder.

A general 'params.yaml' file is printed here for reference.

############################
## Author
############################

author:
  name: "Qubt"
  image: author.jpeg
  greeting: "A personal blog theme for Hugo :evergreen_tree:"
  icon: ":wave:"

############################
## Links
############################

links:
  - github: https://github.com/username
  - facebook: https://facebook.com/me


###############################
## OpenGraph & Twitter Cards
###############################

title: "Qubt Theme"
description: "Demo site build with Qubt & Hugo"
images:
  - thumbnail.jpeg

See the links section for more info.

The last section of the params.yaml file defines some stuff for OpenGraph/Twitter cards. If you share a link to your site the thumbnail.jepg will be used along with the title and desscription.

Links

The links section of the configuration file defines which links to add under the main image on the homepage. The key name of a link must match a supported icon. The value is the link assosiated with the icon.

Clone this wiki locally