Theme Installation
Table of Contents
Prepare Hugo
If you already have Hugo installed — and perhaps a site running — feel free to skip to Install the theme below.
If you have not used Hugo yet, the following is a brief walkthrough to get your first Hugo site ready.
Install Hugo
Follow the official installation guide to install Hugo.
Read this first
- Before installing Hugo, you must install the prerequisites listed on that page: Git and Go.
- Hugo ships in three variants (not operating systems): standard, extended, and extended/deploy. Please install the extended variant.
- Hugo offers multiple installation methods. On macOS, it is recommended to use Homebrew. (The author is not familiar with Windows; please consult the official docs.)
- The Neso theme requires Hugo v0.150.0 or newer.
After installing Git, Go, and Hugo (extended) in that order, verify in your terminal:
|
|
If you see Hugo’s version information, your environment is good to go.
Create a Hugo site
Run the following commands in your terminal.
Move (cd
) to your working directory, then run:
|
|
This creates a folder named mysite
(you can choose any name; we will call it the “Hugo project directory” below) and populates it with the basic files for a site.
Then cd
into that directory:
|
|
Initialize a Git repository in the project directory:
|
|
At this point, create a .gitignore
at the project root. If you are unsure what to include, the following is a good starting point for Hugo projects:
# Hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
/.hugo_build.lock
hugo.exe
hugo.darwin
hugo.linux
# Node modules
node_modules/
Prefer a GUI over the terminal for Git?
- If you are not comfortable with the terminal, install GitHub Desktop. Then add your working directory (which you already ran
git init
on) into GitHub Desktop and proceed with a visual workflow.- In GitHub Desktop, confirm the repo from Current Repository at the top left of the window. Then choose Repository → Repository Settings… from the menu; you can edit
.gitignore
in the left sidebar of the dialog and paste the above rules.- Using GitHub Desktop is fine for Git operations. However, some Hugo tasks still require the terminal.
Your Hugo project directory is now ready to install the theme.
Install the theme
There are multiple ways to install a Hugo theme. Because this theme integrates Tailwind CSS, please install Tailwind via npm
first.
Note
The following steps come from Hugo’s official docs. If anything changes, the official docs take precedence.
In your terminal,
cd
into the Hugo project directory and run:$
npm install --save-dev tailwindcss @tailwindcss/cli
This installs Tailwind packages inside your project directory.
Open
hugo.toml
in your Hugo project directory and add the following:[build] [build.buildStats] enable = true [[build.cachebusters]] source = 'assets/notwatching/hugo_stats\.json' target = 'css' [[build.cachebusters]] source = '(postcss|tailwind)\.config\.js' target = 'css' [module] [[module.mounts]] source = 'assets' target = 'assets' [[module.mounts]] disableWatch = true source = 'hugo_stats.json' target = 'assets/notwatching/hugo_stats.json'
This tells Hugo how to work with Tailwind.
Tailwind is now configured. Next, install the Neso theme itself using one of two methods: Hugo Modules (recommended) or Manual installation.
Install via Hugo Modules (recommended)
This approach keeps your project clean and makes updates easy: Hugo fetches the theme source directly from GitHub so you do not have to manage it yourself.
Important
The Neso theme requires Hugo v0.150.0 or newer.
In your terminal,
cd
into the Hugo project directory and initialize your project as a Hugo module:$
hugo mod init github.com/<your GitHub username>/<your repo name>
For example, if your repo name is
mysite
and your GitHub username isghuser-blah
, you can run:$
hugo mod init github.com/ghuser-blah/mysite
This step is harmless and serves as preparation. If you prefer not to use your GitHub info yet, you can use any placeholder name (letters/digits, no spaces):
$
hugo mod init mysite
Edit
hugo.toml
in your project directory:Under the
[module]
table you added for Tailwind, add a[[module.imports]]
entry with the following path:# other settings... [[build.cachebusters]] source = '(postcss|tailwind)\.config\.js' target = 'css' [module] [[module.imports]] path = "github.com/babeneso/hugo-neso" # must be this path [[module.mounts]] source = 'assets' # other settings...
Run the following command in your project to fetch the latest theme sources from GitHub:
$
hugo mod get -u github.com/babeneso/hugo-neso
(Use this same command later when you want to update.)
If you prefer to pin or update to a specific release (example pins to
v0.1.3
):$
hugo mod get github.com/babeneso/hugo-neso@v0.1.3
It’s a good idea to run the next command to clean up unused entries in go.mod and go.sum:
$
hugo mod tidy
Finally start the local server to preview your site:
$
hugo server
If everything is correct, Hugo prints a
http://localhost:xxxx/
URL. If you have not published any content yet, you will see an empty page, that means the setup succeeded.
Manual installation
Important
The Neso theme requires Hugo v0.150.0 or newer.
Download the theme ZIP from here and extract it.
Rename the folder containing the theme source to
hugo-neso
and place it underthemes/
in your project:mysite/ <- your Hugo project directory ├── ... ├── themes/ │ └── hugo-neso/ <- the Neso theme │ ├── assets/ │ ├── i18n/ │ ├── layouts/ │ ├── hugo.toml │ └── ... └── ...
Edit the same
hugo.toml
where you configured Tailwind earlier (☝️ not the one insidehugo-neso/
) and addtheme = "hugo-neso"
:baseURL = 'https://example.org/' languageCode = 'en-us' title = 'My New Hugo Site' # The above lines are generated by Hugo # Safer to place it here—putting it lower can cause errors theme = "hugo-neso" # Tailwind settings from earlier [build] [build.buildStats] enable = true [[build.cachebusters]] source = 'assets/notwatching/hugo_stats\.json' target = 'css' # other settings...
Finally start the local server to preview your site:
$
hugo server
If everything is correct, Hugo prints a
http://localhost:xxxx/
URL. If you have not published any content yet, you will see an empty page, that means the setup succeeded.