Hugo - 部署教程

Hugo 是一个流行的静态网站生成器,使用 Go 语言编写。它以其速度和灵活性著称,非常适合用于博客和文档网站的构建。以下是 Hugo 的部署教程,帮助你快速上手。

安装 Hugo

  1. 通过包管理器安装
    • macOS(使用 Homebrew):
      brew install hugo
      
    • Windows(使用 Chocolatey):
      choco install hugo -confirm
      
    • Linux(使用 Snap):
      sudo snap install hugo
      
  2. 从二进制文件安装
    • 访问 Hugo Releases 页面,下载适合你系统的二进制文件。
    • 解压下载的文件,并将其添加到系统的 PATH 中。

创建新站点

使用以下命令创建一个新的 Hugo 站点:

hugo new site mysite
```这将在当前目录下创建一个名为 `mysite` 的新文件夹。
## 添加主题
Hugo 有许多现成的主题可供选择。你可以从 [Hugo Themes](https://themes.gohugo.io/) 网站浏览并选择一个主题。以安装 `ananke` 主题为例:
```bash
cd mysite
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
echo 'theme = "ananke"' >> config.toml
Built with Hugo
Theme Stack designed by Jimmy