Initial setup for hugo (1)

Date: 2019/02/09 (initial publish), 2021/08/02 (last update)

Previous Post Top Next Post


Initial hugo setups

Let’s set up a local git repository for a simple personal web pages with blog support using hugo on Debian.

 $ sudo apt-get install hugo
 $ cd /path/to # where you can write
 $ hugo new site <webbuildtree>
Congratulations! Your new Hugo site is created in /path/to/osamuaoki.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from, or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".

Visit for quickstart guide and full documentation.
 $ cd <webbuildtree>
 $ git init
 $ git add .
 $ git commit -m "Initial commit"

Let’s add theme to this. I use hugo-xmin theme:

 $ cd themes
 $ git submodule add
 $ cd ..

Let’s copy template web contents under themes/hugo-xmin/exampleSite directory controlled by the hugo-xmin submodule to the parent repository.

 $ cp -rf themes/hugo-xmin/exampleSite/content .
 $ cp -rf themes/hugo-xmin/exampleSite/layouts .
 $ cp -f  themes/hugo-xmin/exampleSite/config.toml .
 $ git add -A .
 $ git commit -m "template web site"

Check hugo generated web page

Let’s check this website using hugo server which builds and serves the site.

 $ hugo server

                   | EN
  Pages            | 32
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  2
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Total in 9 ms
Watching for changes in /home/osamu/pub/github/osamuaoki/foo/{content,data,layouts,static,themes}
Watching for config changes in /home/osamu/pub/github/osamuaoki/foo/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address
Press Ctrl+C to stop

TIP: -D to generate draft page and -F to generate future page may be handy for hugo server.

Then open another terminal and start your browser.

 $ sensible-browser localhost:1313

This will display the same contents as the DEMO site.

Previous Post Top Next Post