1. 二进制安装(推荐:简单、快速)
Windows:
- 到 Hugo Releases 下载对应的操作系统版本的Hugo二进制文件(hugo或者hugo.exe)
- 创建新文件夹: C:\Hugo, 在Hugo文件夹下面创建子文件夹: C:\Hugo\bin
- 把第一步下载的hugo.exe 放入C:\Hugo\bin
- 设置环境变量Path,在cmd或powershell 输入set PATH=%PATH%;C:\Hugo\bin
Create a new folder: C:\Hugo, assuming you want Hugo on your C drive, although this can go anywhere
Create a subfolder in the Hugo folder: C:\Hugo\bin
Mac下直接使用 Homebrew
安装:
brew install hugo
确认是否安装
hugo version
Step 2: Create a New Site
hugo new site quickstart
the above will create a new Hugo site in a folder named quickstart.
Step 3: Add a Theme
See themes.gohugo.io for a list of themes to consider. This quickstart uses the beautiful Ananke theme.
cd quickstart;\git init;\git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\
\# Edit your config.toml configuration file\# and add the Ananke theme.echo 'theme = "ananke"' >> config.toml
Step 4: Add Some Content
hugo new posts/my-first-post.md
Step 5: Now, start the Hugo server with drafts enabled:
hugo server -D
Mac 下报错theme XXX _default/baseof.html don't have funcition default
可能是hugo版本不对,可以brew uninstall hugo 然后重新安装。