While you can edit pages online in GitLab (e.g., through Web IDE, which also allows to preview Markdown pages), a local development environment of Hugo provides the best support of "what you see is what you get".
- macOS Sierra 10.12.6.
- Hugo v0.54.0.
With the website repository hosted on GitLab, we can clone the repository to local.
- Clone your website repository to local.
git clone https://gitlab.com/username/username.gitlab.io.git
- Configure your GitLab account email within the local repository, which will be used as the identification for all change commit.
git config user.email "email@example.com"
The updated account information can be verified in
[user] email = firstname.lastname@example.org
- Install Homebrew in macOS.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install Hugo.
brew install hugo
Verify the installation by viewing the Hugo version:
Start the Hugo server with "drafts" enabled, which will show all pages including drafts on the local server.
hugo server -D
Now you will be able to view your website locally at: http://localhost:1313.
The Hugo server will keep running until you press Ctrl+C to stop it. Any saved changes will be immediately reloaded.