Hugo Configuration Guide (hugo.toml)#

A concise reference for the most useful configuration options in Hugo, especially for blog setups and themes like Terminal.


๐Ÿงญ Basic Site Configuration#

1
2
3
4
5
baseURL = "https://yourusername.github.io/your-repo/"
languageCode = "en-us"
title = "My Blog"
theme = "terminal"
paginate = 5

Options#

  • baseURL โ†’ Full URL of your deployed site
  • languageCode โ†’ Default language
  • title โ†’ Site title
  • theme โ†’ Theme name (folder inside /themes)
  • paginate โ†’ Number of posts per page

๐Ÿง  Content Behavior#

1
2
summaryLength = 30
enableRobotsTXT = true
  • summaryLength โ†’ Number of words in summaries
  • enableRobotsTXT โ†’ Auto-generate robots.txt

๐Ÿ—‚ URLs & Structure#

1
2
[permalinks]
  posts = "/posts/:year/:month/:title/"
  • Customize how URLs are generated

  • Common variables:

    • :year
    • :month
    • :title
    • :slug

โœ๏ธ Markdown & Code Highlighting#

Check Hugo doc for more details

1
2
3
4
5
6
7
[markup]
  [markup.highlight]
    codeFences = true
    guessSyntax = true
    lineNos = false
    style = "monokai"
    noClasses = false

Highlight options#

  • codeFences โ†’ Enable ``` blocks
  • guessSyntax โ†’ Auto-detect language
  • lineNos โ†’ Show line numbers
  • style โ†’ Color theme
  • noClasses โ†’ Inline styles vs CSS classes

๐Ÿ“ Goldmark (Markdown engine)#

1
2
[markup.goldmark.renderer]
  unsafe = true
  • Allows raw HTML inside Markdown

๐Ÿงฉ Params (Theme-specific)#

1
2
3
4
5
6
[params]
  contentTypeName = "posts"
  themeColor = "orange"
  showMenuItems = 2
  fullWidthTheme = false
  centerTheme = true

โš ๏ธ These depend on the theme. For Terminal:

  • contentTypeName โ†’ Which folder is treated as posts
  • themeColor โ†’ Accent color
  • showMenuItems โ†’ Items in navbar
  • fullWidthTheme โ†’ Stretch layout
  • centerTheme โ†’ Center content

๐ŸŒ Languages & Menus#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
[languages]
  [languages.en]
    title = "My Blog"

    [languages.en.menu]

      [[languages.en.menu.main]]
        identifier = "about"
        name = "About"
        url = "/about"

      [[languages.en.menu.main]]
        identifier = "posts"
        name = "Posts"
        url = "/posts"

Imaging#

Check Hugo doc

๐Ÿ–ผ Static Files#

Hugo automatically maps:

1
/static โ†’ /

Example:

1
static/images/test.png

Becomes:

1
/images/test.png

โšก Performance & Build#

1
2
3
4
5
[minify]
  disableXML = true

[build]
  writeStats = true
  • minify โ†’ Compress output
  • writeStats โ†’ Useful for analyzing assets

๐Ÿ” Taxonomies (Tags & Categories)#

1
2
3
[taxonomies]
  tag = "tags"
  category = "categories"

Use in posts:

1
tags: ["physics", "ml"]

๐Ÿ“ก Outputs#

1
2
[outputs]
  home = ["HTML", "RSS"]
  • Enable RSS feeds or JSON output

๐Ÿงช Development vs Production#

Local preview:

1
hugo serve

Production build:

1
hugo --minify

๐Ÿง  Best Practices#

  • Always set draft = false before publishing
  • Use page bundles for posts with images
  • Avoid hardcoding /your-repo/ in Markdown โ†’ use relative paths
  • Keep baseURL correct for GitHub Pages

๐Ÿš€ Example Minimal Config#

1
2
3
4
5
6
7
8
9
baseURL = "https://yourusername.github.io/your-repo/"
languageCode = "en-us"
title = "My Blog"
theme = "terminal"

[markup]
  [markup.highlight]
    codeFences = true
    guessSyntax = true

โœจ Advanced (Optional)#

1
2
3
[params]
  customCSS = ["css/custom.css"]
  customJS = ["js/custom.js"]
  • Add custom styles or scripts

๐Ÿงญ Final Note#

Hugoโ€™s power comes from:

  • Markdown + configuration
  • Templates (themes)
  • Static asset pipeline

Most behavior is controlled either by:

  1. hugo.toml
  2. Theme params
  3. Layout overrides

Happy writing โœจ