Hugo A Fast and Flexible Website Generator

Quick Start Guide

hugo new site blog
  • go in to the blog folder and modify config.toml for your github url
baseURL = "https://<your-github-account>.github.io/"
  • create new page
hugo new about.md
  • create new post
hugo new post/first.md
  • install a theme
cd themes
git clone https://github.com/xxx/xxx.git
  • localhost server preview
hugo server --buildDrafts --watch

git init
git remote add origin git@github.com:<your-github-account>/blog.git
git rm -r public
git submodule add git@github.com:<your-github-account>/<your-github-account>.github.io.git public
git add .
git commit -m "Hugo content update"
git push -u origin master
hugo --buildDrafts
cd public
git add .
git commit -m "Blog update"
git push origin master
  • In your blog folder, create a batch file for one click deploy.
    • windows : save below content as .cmd
set workdir=%~dp0
set current=%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
cd %workdir%
git add -A
git commit -m "Hugo content update %current%"
git push -u origin master
hugo --buildDrafts
cd public
git add -A
git commit -m "Blog update %current%"
git push origin master
  • linux : save below content as .sh
#!/bin/bash
workdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $workdir
git add -A
git commit -m "Hugo content update `date`"
hugo --buildDrafts
cd public
git add -A
git commit -m "Blog update `date`"
git push origin master