Setting Hugo article URLs structure as the same as under /content/ structure.
This article explains how to setting Hugo article URLs structure as the same as under /content directory structure.
This article explains how to setting Hugo article URLs structure as the same as under /content directory structure.
The following lists are the table of contents about this article.
- Target audience
- Environment
- Preconditions
- Update Hugo
- Change setting to the config file.
- Example
- Reference articles
Target audience
- Those who want to organize the posts by category, and setting URLs structure as the same as under /content directory structure.
Environment
- WSL 2 (Ubuntu 20.04 LTS)
- Hugo
- Homebrew
Preconditions
- Installed Hugo
- Installed Homebrew
Update Hugo
If your Hugo version is 0.83.0 or later, skip this section.
If not, you need to upgrade Hugo because an attribute that is used in this article added at version 0.83.0.
In this article case, uninstall Hugo by apt-get then re-install by Homebrew because apt-get repository has not known latest version Hugo.
The re-install flow is the below.
sudo apt-get remove -y hugo
brew update
brew install hugo
When you execute brew update if the below error message displayed, please execute update-reset then execute brew update again.
Change setting to the config file.
Change the permalinks section like below. (The below case is just an example.)
[permalinks]
posts = "/:year/:month/:day/:filename/" # Before change
posts = "/:sections/:filename" # After change
If you use config.yaml or config.json, please refer to this page.
Hugo: URL Management
Example
I will put the example, which is I set up this site. If you are interested in that, check it!
organizing the posts
Reference articles
Install Hugo | Hugo: Homebrew (macOS)
Homebrew 警告への対処(Another active Homebrew update process is already in progress)
Section content not showing