如何用 hugo 搭建个人博客

Mac 用户

  1. 安装hugo

    brew install hugo
    hugo version
    
  2. 创建新的环境

    hugo new site xxx.github.io-creator
    
  3. 添加主题

    cd xxx.github.io-creator
    git init
    xxxxxxxxx //主题下载地址
    
  4. 设置主题名

    echo echo 'theme = "ananke"' >> config.toml
    
  5. 新建文章

    hugo new post/my first page.md
    
  6. 写文章,将 draft: true 改为 ``draft: false`

  7. 运行 hugo server -D

  8. 打开 http://localhost:1313/ ,会看到一个示例网站。

    • 配置好config.toml
    • 文章写在./content/post
  9. 运行hugo -D

  10. cd pablic/

  11. git add .

  12. git commit -v

  13. git push

说明

具体操作参照hugo官方文档