使用Hugo

经常使用 Hugo 的几个命令,需要积累

  hugo new site blogsite

  hugo new about.md

  hugo new post/first.md

  hugo server

启动Hugo服务

  hugo server --bind="0.0.0.0" -v -w -p 80 -b http://www.readmorejoy.com

  hugo server --bind=0.0.0.0 -p 80 -b http://www.readmorejoy.com

  hugo server --liveReloadPort=443 --baseURL=https://www.readmorejoy.com --appendPort=false

Hugo开发人员

Hugo now has:

34743+ stars
439+ contributors
314+ themes

配置 systemd 启动Hugo服务

touch /lib/systemd/system/hugo.service

[Unit]
Description=Hugo server
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/hugo.pid
ExecStart=/usr/local/bin/god --nohup --pidfile /var/run/hugo.pid -- /usr/local/bin/hugo server --source /goblog  --baseURL https://www.readmorejoy.com --appendPort=false --disableLiveReload --log --logFile /var/log/hugo.log -DEF --port 80 --bind 0.0.0.0
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

推荐这个 simple 类型

[Unit]
Description=Hugo server
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/hugo server --minify --source /goblog --baseURL https://www.readmorejoy.com --appendPort=false --disableLiveReload=false --liveReloadPort=443 -DEF --port 80 --bind 0.0.0.0
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl enable hugo
systemctl start hugo
systemctl restart hugo
systemctl status hugo