使用hugo创建并更新博客

首先下载完成hugo,widows下切换目录可能会出现hugo运行失败,只需要将下载的hugo可执行文件复制一份到相应的目录下即可

本地搭建

创建博客,申请站点

  • Hugo new site myblog(自己起名)

切换目录

  • Cd myblog(目录名)

#下载主题,根据自己需要而定 hugo主题下载

下载主题

  • Git clone 网址 themes/主题名

配置主题请见这里

启动服务,可在localhost:1313查看

  • Hugo server -t 主题名 –buildDrafts

新建文章,配置不改一般都会生成到public文件下

  • hugo new post/名字

Github上建好仓库

  • 仓库名: your_name.github.io

为文章配置主题

接下来推到远端

切换目录

此时已生成public文件

  • Cd public/

  • Git init

  • Git add *

  • Git commit -m “提交信息”

连接到远程仓库

  • Git remote add origin 仓库地址.git   完整的github仓库地址

推到github

  • Git push -u origin master

若出现 remote origin already exists,

连接一次后就会出现这句提醒,这时就不需要再重新连接了,如果链接已存在但不是你需要的链接可以 先运行 git remote rm origin 清除远程连接

配置完成后即可在 https://your_name.github.io查看博客

最终效果请看这里

更新博客

 搭建好博客之后,目前没有找到好的更新办法,更新需要从hugo new post/创建文章这一步开始走一遍流程。