美文网首页
macos基于hugo 搭建自己的博客并部署到github

macos基于hugo 搭建自己的博客并部署到github

作者: ThompsonHen | 来源:发表于2020-07-16 14:16 被阅读0次

安装hugo

$ brew install hugo
image.png

查看hugo版本

$ hugo version
image.png

指定一个文件夹

$ hugo new site myblog
image.png

到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
image.png

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


image.png

指定部署地址

$ hugo --theme=m10c --baseUrl="https://thompsonhen.github.io/" --buildDrafts
image.png

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

image.png
$ 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

成功!!!


image.png

相关文章

网友评论

      本文标题:macos基于hugo 搭建自己的博客并部署到github

      本文链接:https://www.haomeiwen.com/subject/wwephktx.html