Hugo 是什么?
Hugo is the world’s fastest static website engine. It’s written in Go (aka Golang) and developed by bep, spf13 and friends.
环境准备
操作系统
Debian系(Ubuntu),包管理工具apt。
Go Install
官网下载地址
复制安装包地址URL,wget -c URL,按照官方网站教程执行安装命令。
tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version 验证是否成功
Git 安装
apt install git
Hugo Install
Fetch from GitHub(从Github 安装)
mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install --tags extended
Remove --tags extended if you do not want/need Sass/SCSS support.
Hugo使用
如果可以请直接参考官方网站的使用步骤,官方使用链接。
hugo new site hugo_site
cd hugo_site
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
echo ‘theme = “ananke”’ >> config.toml
hugo new posts/my-first-post.md
部署到Github
参看我的Git文章。
出现的问题
Debian9系统在从GitHub上安装Hugo完成后,输入hugo提示找不到命令,猜测可能是因为VPS配置太低的缘故。
解决方案:在VMware虚拟机上使用Ubuntu16.04LTS操作系统重新执行上述命令成功。
直接使用sudo apt install golang-go安装Go时候,在go install 安装hugo时候出现问题,该问题未解决。
其他
与Hugo类似的就是Hexo(作者是台湾人),Hexo + Github Pages。Hexo国人用的比较多,因为没有语言障碍,使用起来很方便,相关的中文资料也很多。Hexo使用的是Node.js技术,而Hugo使用的则是Go语言。
附上Hexo的官方说明 :
Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。