安装hugo
$ brew install hugo

查看hugo版本
$ hugo version

指定一个文件夹
$ hugo new site myblog

到hugo官网中找到喜欢的主题
https://themes.gohugo.io/
克隆主题到本地themes文件夹中
$ git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c
添加一篇新的博文
$ hugo new post/第一篇博客.md
找到博文所在的文件夹并对其进行编辑
$ cd content/post
$ ls -l
$ vi 第一篇博客.md
本地部署
$ hugo server -t m10c --buildDrafts

到自己的github中创建一个用于放置文件的仓库
注意必须跟github账户名相同且小写

指定部署地址
$ hugo --theme=m10c --baseUrl="https://thompsonhen.github.io/" --buildDrafts

在本地mylog文件夹中将出现一个public文件夹

$ cd public
$ git init
$ git add .
$ git commit -m "第一篇博客"
接下来将本地public文件夹与github仓库关联起来
$ git remote add origin https://github.com/ThompsonHen/thompsonhen.github.io
$ git push -u origin master
成功!!!

网友评论