1. What you need?
- Your own domain name
- Visual Studio Code (Editor)
- Github (Contents management)
- Hugo (Site Generator)
- Netlify (Web Hosting)
2. Get your own domain name
I use a Japan based domain name service. Onamae.com
Cost for domain name is from 0 Yen to million Yen ~~~~
3. Visual Studio Code / Github
Please consider the VS Code and Github as set. You can use BitBucket as well but for people who use Hugo, Github is a better choice. A lot of Hugo themes are repositorized in Github.
4 Install Hugo
For MacOS:
- Brew install Hugo
- Create a new site:
hugo new site [sitename] -f yaml
This command will create a directory with the name of the site. I choiced yaml as the format of configuration file. You can choose toml (hugo default) or json
5. Local Git Repository
Under the directory created by Hugo
- git init
- git add .
- _echo public/ » .gitignore (untrack the public directory)
- _echo public/* » .gitignore
You need to connect to Github for publish later.
6. Set the theme
This is one of the most important decision you need to make. Go to –>
- https://themes.gohugo.io to select your favorite theme. I tried papermod, ananke, mainroad
Add the theme source as git submodule
- git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
Define the theme in configuration file Add one line to hugo.yaml as
- theme = ‘ananke’
if the theme is papermod then
- theme = ‘papermod’
7. Add contents
Hugo will generate the template markdown file *.md in content directory
- hugo new post/[Your Post title].md
The [Your Post title].md will be generated under directory of content/posts.
It is in Markdown format. Markdown is variation of html Markup language. Very handy to edit.
Hugo will generate the html for you during site building
8. Site build
- Test the site before building
- hugo server -D
- URL to check the website: http://localhost:1313
This command will start a local web server to allow you check the contents before build. 2. Build the site
- hugo
This command will create/update the web contents under directory public With Netlify, you don’t need to build the site locally. But it is recommended to build local site to help trouble shooting.
9. Commit to Local Git
Final step of the all of the local activities. You can commit to git and start to compose your web contents.
- git commit -m “Complete the build”