跳过正文

Init Blog With Hugo Mod

·67 字·1 分钟
yjdyamv
作者
yjdyamv
偶尔写点东西,记录生活,分享知识。

近来我的博客迁移到了hugo框架下,并使用blowfish作为主题,以下是我探索的过程。

  1. 创建站点

    hugo new site mywebsite
  2. 使用主题(共有三种方法)

    • git submodule:

      git init
      git submodule add -b main https://github.com/nunocoracao/blowfish.git themes/blowfish

      并解注释(或手动添加)config/_default/hugo.toml里的theme = blowfish

    • hugo mod(使用go 下载包)

      # If you're managing your project on GitHub
      hugo mod init github.com/<username>/<repo-name>
      
      # If you're managing your project locally
      hugo mod init my-project

      并编辑config/_default/module.toml

      [[imports]]
      disable = false
      path = "github.com/nunocoracao/blowfish/v2"

      随后hugo server就可以自动下载包了

    • 手动复制主题到对应文件夹下

hugo mod的好处
#

由于国内网络不太好,使用git submodule update --init --recursive比较吃亏。另外由于go mod国内有源可以换,所以更快?(存疑)