diff options
author | nodejh <jianghangscu@gmail.com> | 2021-08-16 06:30:47 +0300 |
---|---|---|
committer | nodejh <jianghangscu@gmail.com> | 2021-08-16 06:30:47 +0300 |
commit | 9061e430217508650a88956d1aa06e255917856c (patch) | |
tree | 50ebda7ddb3b0e8ff8106e6d06b418de2e3f5d29 | |
parent | a67ad2553165f81a00f73ccdf0897981a54af277 (diff) |
doc: add Production description in README-zh_CN
-rw-r--r-- | README-zh_CN.md | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/README-zh_CN.md b/README-zh_CN.md index a24e541..5add95f 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -9,7 +9,7 @@ - [在线 Demo](https://nodejh.github.io/hugo-theme-mini) - [示例网站源码](https://github.com/nodejh/hugo-theme-mini/tree/master/exampleSite) -特性: +特性: - 快 - 简约 @@ -23,19 +23,19 @@ ### 1.1 使用 Hugo 模块安装 (推荐) -> ⚠️ 如果你使用的是 [二进制包](https://gohugo.io/getting-started/installing/#binary-cross-platform) 安装的 Hugo, 那么你需要在电脑上安装 Go 语言. 你可以使用下面的命令检查是否安装 Go: +> ⚠️ 如果你使用的是 [二进制包](https://gohugo.io/getting-started/installing/#binary-cross-platform) 安装的 Hugo,那么你需要在电脑上安装 Go 语言。 你可以使用下面的命令检查是否安装 Go: > ``` > $ go version > ``` -> Go 语言从 v1.14 开始支持模块. [下载 Go](https://golang.org/dl/). +> Go 语言从 v1.14 开始支持模块. [下载 Go](https://golang.org/dl/)。 -1. 在项目目录初始化 hugo 模块系统,如果之前已经执行过则忽略此步骤: +1. 在项目目录初始化 hugo 模块系统,如果之前已经执行过则忽略此步骤: ```bash $ hugo mod init github.com/<your_user>/<your_project> ``` -2. 在 `config.yaml` 中添加主题: +2. 在 `config.yaml` 中添加主题: ```yaml theme: @@ -45,19 +45,19 @@ ### 1.2 使用 Git Submodule 安装 -1. 在项目目录中执行下面的命令,将 hugo-theme-mini 作为 submodule: +1. 在项目目录中执行下面的命令,将 hugo-theme-mini 作为 submodule: ```bash $ git submodule add https://github.com/nodejh/hugo-theme-mini.git themes/mini ``` -2. 在 `config.yaml` 中配置主题: +2. 在 `config.yaml` 中配置主题: ```yaml theme: mini ``` -更多信息可参考 Hugo 官方文档 [setup guide](//gohugo.io/overview/installing/). +更多信息可参考 Hugo 官方文档 [setup guide](//gohugo.io/overview/installing/)。 ## 2. 开始使用 @@ -70,16 +70,14 @@ 在 [`exampleSite`](https://github.com/nodejh/hugo-theme-mini/tree/master/exampleSite) 目录中有一个 [`config.yaml`](https://github.com/nodejh/hugo-theme-mini/blob/master/exampleSite/config.yaml) 的配置文件,你可以将其复制到你的项目根目录中,将一些配置项修改为你的配置。这些配置都可以随意修改。 -Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-mini/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.yaml`](https://github.com/nodejh/hugo-theme-mini/blob/master/exampleSite/config.yaml). To use it, copy the [`config.yaml`](https://github.com/nodejh/hugo-theme-mini/blob/master/exampleSite/config.yaml) in the root folder of your Hugo site. Feel free to change the strings in this theme. - -> ⚠️ 你需要删除这行配置: `themesDir: ../../` +> ⚠️ 你需要删除这行配置: `themesDir: ../../` 。 ### 2.2 评论功能 -要使用评论功能,你需要添加下面的配置: +要使用评论功能,你需要添加下面的配置: -- 设置 Disqus: `disqusShortname: your-disqus-shorname` -- 启用评论: +- 设置 Disqus: `disqusShortname: your-disqus-shorname` +- 启用评论: ```yaml params: @@ -88,10 +86,10 @@ Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-mini ### 2.3 Google 分析 -要使用 Google 分析功能,你需要添加下面的配置: +要使用 Google 分析功能,你需要添加下面的配置: -- 设置 Google Analytics ID: `googleAnalytics: your-google-analytics-id` -- 启用 Google Analytics: +- 设置 Google Analytics ID: `googleAnalytics: your-google-analytics-id` +- 启用 Google Analytics: ```yaml params: @@ -100,7 +98,7 @@ Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-mini ### 2.4 Logo 和 favicon -你可以替换网站中的 Log 和 favicon,只需要将你的图片放在网站的 `static/images` 中,并分别命名为 `avatar.png` 和 `avicon.ico`. 下面是项目目录示例: +你可以替换网站中的 Log 和 favicon,只需要将你的图片放在网站的 `static/images` 中,并分别命名为 `avatar.png` 和 `avicon.ico`。下面是项目目录示例: ```shell - content @@ -112,7 +110,7 @@ Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-mini ### 2.5 运行网站 -为了检查网站运行情况,你可以在本地启动 hugo server: +为了检查网站运行情况,你可以在本地启动 hugo server: ```bash $ hugo server @@ -120,6 +118,21 @@ $ hugo server 现在你就可以在浏览器中打开 http://localhost:1313 查看你的网站了。 +### 2.6 生产环境 + +如果要将网站部署到生产环境 (例如支持 Google Analytics),你需要在 `hugo` 命令前增加环境变量 `HUGO_ENV=production`。例如: + +```bash +HUGO_ENV=production hugo +``` + +注意:上面的命令对 Windows 无效。如你使用 Windows,则需要使用下面的命令: + +```bash +set HUGO_ENV=production +hugo +``` + ## 3. 可选配置 ### 3.1 在某些页面禁用评论 |