Installation
Hugo, the theme, and the three settings Vitrine needs from your site.
Requirements
- Hugo (opens in a new tab) 0.146 or newer. The standard edition is enough; Vitrine doesn’t use Sass.
- Git (opens in a new tab).
- Go (opens in a new tab), only if you add the theme as a Hugo module (recommended, see below).
Check what you have:
hugo version
git --version
go versionCreate a site
Skip this if you have one already.
hugo new project my-docs
cd my-docs
git initAdd the theme
There are two ways. A Hugo module is the modern one: Hugo downloads the theme itself, in the version you name,
and updating is one command. A Git submodule puts a copy of the theme’s repository into your site’s themes/
folder and needs no Go.
Turn your site into a module, then import the theme in hugo.toml:
hugo mod init github.com/you/my-docs[module]
[[module.imports]]
path = "github.com/maxfettinger/vitrine"hugo mod get github.com/maxfettinger/vitrine@latestThe module path after init is a name for your site, usually its repository’s address; it doesn’t have to exist.
Update the theme later with hugo mod get -u.
Add the theme’s repository under themes/ and name it in hugo.toml:
git submodule add https://github.com/maxfettinger/vitrine.git themes/vitrinetheme = "vitrine"Someone cloning your site later needs git clone --recurse-submodules. Update the theme with
git submodule update --remote.
The settings Vitrine needs
Hugo lets a theme set only a few kinds of settings for a site (its params, menus, output formats and media types).
Vitrine needs three more, so they go in your hugo.toml:
# Only Markdown files are pages: an example's example.html can sit in a folder next to its page
[contentTypes]
[contentTypes.'text/markdown']
# Code colours as CSS classes, so light and dark mode can colour them
[markup.highlight]
noClasses = false
# "On this page" lists the h2 and h3 headings
[markup.tableOfContents]
startLevel = 2
endLevel = 3Without contentTypes, Hugo treats example.html in a page’s folder as a page of its own and the
example shortcode can’t find it. Examples in assets/examples/ work either way.
And a title, a description for search engines and link previews, and the main menu, which becomes the tabs in the header:
baseURL = "https://docs.example.org/"
title = "my-lib"
[params]
description = "my-lib does one thing well."
[[menus.main]]
name = "Docs"
pageRef = "/docs"
weight = 10Run it
hugo serverOpen the address it prints, usually http://localhost:1313/. The page reloads while you edit. Next:
your first pages.