Hugo usage issues summary
Update: 2021/10 when pull at other location or machine, the submodule settings is lost, need reinitialization the submodule, only exec following this command:
1git submodule update --init --recursive
Usage scene
-
In my github repo initialize two repos
- One to storage Hugo sourcecode and markdown files
- And other one use release finaly site resources
-
Has two folders themes and public as github submodes
1 git submodule add https://github.com/don.chen/blog.github.io public 2 git submodule update --init
and every time wited markdown article and execute
1git submodule update public 2git pull origin master 3cd public && git add . && git commit -am "something is added" 4git push origin HEAD:master
-
Prepare
deploy.sh
script to automatic generate site and commit
1 #!/bin/sh
2
3 # If a command fails then the deploy stops
4 set -e
5
6 printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"
7
8 # Build the project.
9 hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
10
11 # Go To Public folder
12 cd public
13
14 # Add changes to git.
15 git add .
16
17 # Commit changes.
18 msg="rebuilding site $(date)"
19 if [ -n "$*" ]; then
20 msg="$*"
21 fi
22 git commit -m "$msg"
23
24 # Push source and build repos.
25 git push origin master
That's all