Blog

Start Here: Configuration and Content

Jul 25, 2020 | Temps de lectura: 2 minuts

Series: quickstart

Tags: code, features

Here are some helpful tips for setting up this theme.

Most of what you’ll want to configure is demonstrated in the exampleSite config.toml. This is Hugo’s configuration file. You can copy the config.toml in the exampleSite/ to your site root get started.

Here are all the options included in the (live!) configuration file for this example site!

Below are some specific things you might like to configure right away.

Introduction allows the use of Hugo’s rich built-in syntax highlighting capabilities. See Syntax Highlighting in the Hugo docs.

Below is an example configuration for Highlight. See Highlight in the Hugo docs for more.

[markup]
  [markup.highlight]
    codeFences = true
    guessSyntax = false
    hl_Lines = ""
    lineNoStart = 1
    lineNos = false
    lineNumbersInTable = true
    noClasses = true
    # For styles, see https://xyproto.github.io/splash/docs/longer/all.html
    style = "friendly"
    tabWidth = 4

Custom shortcodes can be added to a layouts/shortcodes/ directory in your site root. For example, I used a shortcode above to display the current configuration file for this site! You can see the shortcodes in the raw Markdown for this page to understand how they work.

To ensure Hugo renders any HTML that your shortcode or other additions like Font Awesome uses in posts, make sure these lines for the Goldmark renderer are in your config.toml:

[markup]
defaultMarkdownHandler = "goldmark"

[markup.goldmark]

[markup.goldmark.renderer]
unsafe = true

The easiest way to start adding content to your site is to copy the exampleSite folder to your site’s root directory.

You can change the existing posts to see how it all works. Add new pages using the hugo new command.

To understand how different pages are rendered by Hugo, read Content Organization in the Hugo docs.