主题文档 - 安装部署
chidocs 是 hugo 的主题,所以我们必须先安装 hugo。
安装 hugo
使用 go install
CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latest
注意
只能安装 extended 版本,因为只有这个版本可以解析 sass,我们的样式表使用了 sass。
不同系统
在不同操作系统上安装 hugo 可以参考官方文档页https://gohugo.io/installation/实际上用 go install 安装是更舒服的选择。
信息
使用 go install 之外的方法安装,不一定是最新的版本。
创建站点安装主题
使用 hugo 自带的工具可以很方便的创建站点。
hugo new site blog
cd blog
git init
mkdir themes
git submodule add https://github.com/langwan/chidocs.git themes/chidocs
配置
cp themes/chidocs/exmapleSite/config.yaml .
技巧
您可以把 exmapleSite 整个目录拷贝到当前目录下使用,也可以仅拷贝 config.yaml 文件进行二次修改。
运行
hugo server
新增文档
hugo new posts/my-first-post.md
发布
hugo
使用 hugo 命令生成 public 文件夹的静态文件,可以把静态文件发布到任何 web 服务器上即可浏览。
github pages
技巧
利用 github actions 功能您只需要提交 git 请求即可渲染站点。