Install a single Hugo theme
masterthemes directory and clone the specific theme's repository URL.repository·master·Indexed 23 days ago
https://github.com/gohugoio/hugothemesA collection of community-created Hugo themes integrated into the official Hugo theme showcase at themes.gohugo.io. This repository provides instructions for installing themes, submitting new themes to the showcase, configuring theme.toml metadata, and using build scripts like generateThemeSite.sh and reviewTheme.sh for local testing and site generation.
themes directory and clone the specific theme's repository URL.If your theme uses Hugo Pipes methods like toCSS or PostCSS, you must commit the generated resources folder to your repository (or to exampleSite) so the theme works in environments without the full Hugo build pipeline.
To generate these files:
hugo server from the root of a Hugo project using your theme (generates /resources/).hugo (generates public/resources).exampleSite.To install the entire collection of available Hugo themes, clone the repository recursively into a themes directory within your working directory.
git clone --depth 1 --recursive https://github.com/gohugoio/hugoThemes.git themesTo test a single theme without building the entire site, use the ./reviewTheme.sh script. This script uses a dedicated directory (defaulting to ./review) to store themes, which significantly reduces build time.
To run a review, provide the URL to the Git repository containing the theme you wish to test. You can optionally specify a custom directory for the theme storage using the -t flag.
Note: If the theme is not already whitelisted in ./generateThemeSite.sh, you may need to add it there first.
Once the script runs, the Hugo theme site is automatically served at http://localhost:1313.
./reviewTheme.sh <repo> -t <path>To have your theme automatically added to themes.gohugo.io, follow these steps:
hugo new theme <THEMENAME>.theme.toml file in the theme root.README.md in the theme root.[ThemeDir]/images/tn.png and a screenshot at [ThemeDir]/images/screenshot.png.Requirements for inclusion:
resources folder if using Hugo Pipes.exampleSite/config.{toml, yaml, json} must use https://example.com as the baseurl.exampleSite should not have third-party tracking (analytics, etc.) enabled with real IDs.Use the ./generateThemeSite.sh script to generate the full Hugo theme site (the site seen at themes.gohugo.io). This process downloads all themes listed in the repository.
Warning: This is a resource-intensive operation that requires significant disk space and a long execution time.
To test the complete build locally, pass the root of your local baseUrl as the first argument.
./generateThemeSite.sh http://localhost:1313You can test how your theme will appear on the Hugo Themes website by using the local review script:
hugoThemes repository._script/ directory: cd _script/../reviewTheme.sh <URL_TO_THEME_GIT_REPO>.http://localhost:1313 in your browser.If your theme requires a non-standard content structure, you may need to whitelist it in ./generateThemeSite.sh.
You can customize which repositories are used during the build process by setting the following environment variables before running ./generateThemeSite.sh:
HUGO_THEMES_REPO: Specifies the repository containing all themes to be displayed.HUGO_THEME_SITE_REPO: Specifies the repository used for the Hugo theme site itself.HUGO_EXAMPLE_SITE_REPO: Specifies the repository used for the Hugo example site.HUGO_THEMES_REPO=<repo> ./generateThemeSite.sh http://localhost:1313
HUGO_THEME_SITE_REPO=<repo> ./generateThemeSite.sh http://localhost:1313
HUGO_EXAMPLE_SITE_REPO=<repo> ./generateThemeSite.sh http://localhost:1313The theme.toml file is the only accepted metadata format (do not use .yaml or .json). It must be located at the root of your theme.
Required fields include name, license, licenselink, description, homepage, tags, features, and min_version. Note that min_version must use full semver (e.g., 0.59.0 instead of 0.59).
name = "Theme Name"
license = "MIT"
licenselink = "Link to theme's license"
description = "Theme description"
homepage = "Website of your theme"
tags = ["blog", "company"]
features = ["some", "awesome", "features"]
min_version = "0.59.1"
# If the theme has multiple authors
authors = [
{name = "Name of author", homepage = "Website of author"},
{name = "Name of author", homepage = "Website of author"}
]
# If the theme has a single author
[author]
name = "Your name"
homepage = "Your website"
# If porting an existing theme
[original]
author = "Name of original author"
homepage = "His/Her website"
repo = "Link to source code of original theme"To ensure your theme works correctly when hosted in a subdirectory (like the Hugo Themes showcase):
<div style="background: url('{{ "images/background.jpg" | absURL }}')">./ as they will point to the host root instead of the theme's subdirectory.https. Do not use relative protocol URLs (e.g., //cdn.com/...).