How to Create Site With Hugo

Install hugo on Centos7

Add epel repo

The Hugo package can be found at, take the correct version, and place it in /etc/yum.repos.d/hugo.repo

vim /etc/yum.repos.d/hugo.repo 

# add content below the file
name=Copr repo for hugo owned by daftaupe


yum -y install hugo
hugo version

Quick start

# Create a new site 
hugo new site mysite

# Add a Theme
cd mysite
git init
git submodule add themes/ananke

echo theme = \"ananke\" >> config.toml

# Add a new page 
hugo new post/

Run the server locally

hugo server -D --watch --verbose  -p 8080

Deploy to S3 Bucket

  • AWS CLI has been installed and with AWS access key and token configured in the deployment machine
  • In the config.toml file, we need to provide S3 bucket details
name = "mydeployment"
URL = "s3://[your s3 bucket name]]?region=[region]}"

The run the command below to build and deploy the site to S3

rm -rf public && hugo && hugo deploy

Convert Wordpress to Hugo

  • Go to Wordpress to hugo exporter, and download it as zip file
  • Log into wordpress site, and upload the zip file as plugin
  • go to Tools-> Export to Hugo
  • if the ui doesn’t work, try command line
ssh root@your.server
sudo apt-get install php7.2-zip  # Need to make sure php zip insalled, this command is for an ubuntu box
cd /var/www/html/wp-content/plugins/wordpress-to-hugo-exporter-master/
php hugo-export-cli.php
# a will be created, unzip and place it under content folder of the Hugo site