From 901fc3beb81e2df6ece2a9d391249abff07c5a9c Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 25 Aug 2024 20:44:18 +0800 Subject: [PATCH] =?UTF-8?q?Docs:=20=E5=AE=8C=E5=96=84=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=B3=95=E9=85=8D=E7=BD=AE=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../getting-started/configuration/index.md | 201 ++++++++++-------- .../getting-started/configuration/index.md | 201 ++++++++++-------- 2 files changed, 230 insertions(+), 172 deletions(-) diff --git a/content/en/documentation/getting-started/configuration/index.md b/content/en/documentation/getting-started/configuration/index.md index e3a8a9d..bd445bc 100644 --- a/content/en/documentation/getting-started/configuration/index.md +++ b/content/en/documentation/getting-started/configuration/index.md @@ -134,6 +134,120 @@ menu: --- ``` +## Markup Configuration + +Configure rendering of markup to HTML via the root configuration keys `markup`. + +This section only records some [necessary configuration][necessary-configuration-for-theme] for the **FixIt** theme. For more details, see the [Configure markup][configuration-markup] page. + +```toml +[markup] + [markup.highlight] + codeFences = true + lineNos = true + lineNumbersInTable = true + noClasses = false +``` + +## Taxonomies Configuration + +The FixIt theme has three built-in [taxonomies][configure-taxonomies]: categories, tags, and collections. The default `taxonomies` configuration of the theme is as follows: + +```toml +[taxonomies] + category = "categories" + tag = "tags" + collection = "collections" +``` + +If you want the `taxonomies` configuration to always be consistent with the theme, you can set `taxonomies._merge` to `shallow`. + +After that, you can categorize your posts, for example: + +```yaml +--- +title: Configure FixIt +date: 2024-03-07T15:37:59+08:00 +tags: + - Configuration + - Installation + - Basics +categories: + - Documentation +collections: + - Getting Started +--- +``` + +## Custom output formats + +Hugo can output content in multiple formats. The **FixIt** theme takes advantage of this feature. In order to fully configure the theme, configure the following options into `hugo.toml`. + +More details about the configuration of output formats can be found in the [Custom output formats][hugo-output-formats] page. + +```toml +[mediaTypes] + [mediaTypes."text/markdown"] + suffixes = ["md"] + +[outputFormats] + # {{< version 0.3.0 >}} Options to make output /archives/index.html file + [outputFormats.archives] + path = "archives" + baseName = "index" + mediaType = "text/html" + isPlainText = false + isHTML = true + permalinkable = true + # {{< version 0.3.0 >}} Options to make output /offline/index.html file + [outputFormats.offline] + path = "offline" + baseName = "index" + mediaType = "text/html" + isPlainText = false + isHTML = true + permalinkable = true + # {{< version 0.3.0 >}} Options to make output readme.md file + [outputFormats.readme] + baseName = "readme" + mediaType = "text/markdown" + isPlainText = true + isHTML = false + # {{< version 0.3.0 changed >}} Options to make output baidu_urls.txt file + [outputFormats.baidu_urls] + baseName = "baidu_urls" + mediaType = "text/plain" + isPlainText = true + isHTML = false + # {{< version 0.3.10 >}} Options to make output search.json file + [outputFormats.search] + baseName = "search" + mediaType = "application/json" + rel = "search" + isPlainText = true + isHTML = false + permalinkable = true +``` + +You only need to configure the root configuration key `outputs`, because the **FixIt** theme has already configured the `mediaTypes` and `outputFormats` for you. + +```toml +# Options to make hugo output files, the optional values are below: +# home = ["html", "rss", "archives", "offline", "readme", "baidu_urls", "search"] +# page = ["html", "markdown"] +# section = ["html", "rss"] +# taxonomy = ["html"] +# term = ["html", "rss"] +[outputs] + home = ["html", "rss", "archives", "offline", "search"] + page = ["html", "markdown"] + section = ["html", "rss"] + taxonomy = ["html"] + term = ["html", "rss"] +``` + +If you want the `outputs` configuration to always be consistent with the theme, you can set `outputs._merge` to `shallow`. + ## Theme Configuration {#theme-configuration} In addition to Hugo global configuration, **FixIt** provides some theme configuration via the root configuration keys `params`. @@ -1520,92 +1634,6 @@ mDevtools logoUrl = "" ``` -## Markup Configuration - -Configure rendering of markup to HTML via the root configuration keys `markup`. - -This section only records some [necessary configuration][necessary-configuration-for-theme] for the **FixIt** theme. For more details, see the [Configure markup][configuration-markup] page. - -```toml -[markup] - [markup.highlight] - codeFences = true - lineNos = true - lineNumbersInTable = true - noClasses = false -``` - -## Custom output formats - -Hugo can output content in multiple formats. The **FixIt** theme takes advantage of this feature. In order to fully configure the theme, configure the following options into `hugo.toml`. - -More details about the configuration of output formats can be found in the [Custom output formats][hugo-output-formats] page. - -```toml -[mediaTypes] - [mediaTypes."text/markdown"] - suffixes = ["md"] - -[outputFormats] - # {{< version 0.3.0 >}} Options to make output /archives/index.html file - [outputFormats.archives] - path = "archives" - baseName = "index" - mediaType = "text/html" - isPlainText = false - isHTML = true - permalinkable = true - # {{< version 0.3.0 >}} Options to make output /offline/index.html file - [outputFormats.offline] - path = "offline" - baseName = "index" - mediaType = "text/html" - isPlainText = false - isHTML = true - permalinkable = true - # {{< version 0.3.0 >}} Options to make output readme.md file - [outputFormats.readme] - baseName = "readme" - mediaType = "text/markdown" - isPlainText = true - isHTML = false - # {{< version 0.3.0 changed >}} Options to make output baidu_urls.txt file - [outputFormats.baidu_urls] - baseName = "baidu_urls" - mediaType = "text/plain" - isPlainText = true - isHTML = false - # {{< version 0.3.10 >}} Options to make output search.json file - [outputFormats.search] - baseName = "search" - mediaType = "application/json" - rel = "search" - isPlainText = true - isHTML = false - permalinkable = true -``` - -You only need to configure the root configuration key `outputs`, because the **FixIt** theme has already configured the `mediaTypes` and `outputFormats` for you. - -```toml -# Options to make hugo output files, the optional values are below: -# home = ["html", "rss", "archives", "offline", "readme", "baidu_urls", "search"] -# page = ["html", "markdown"] -# section = ["html", "rss"] -# taxonomy = ["html"] -# term = ["html", "rss"] -[outputs] - home = ["html", "rss", "archives", "offline", "search"] - page = ["html", "markdown"] - section = ["html", "rss"] - taxonomy = ["html"] - term = ["html", "rss"] -``` - -{{< admonition tip >}} -If you want the `outputs` configuration to always be consistent with the theme, you can set `outputs._merge` to `shallow`. -{{< /admonition >}} - ## Favicon Generation It is recommended to put your own favicons, `browserconfig.xml` and `site.webmanifest` files into the `/static` directory. @@ -1640,3 +1668,4 @@ They're easily created via . [configuration-markup]: https://gohugo.io/getting-started/configuration-markup/ [necessary-configuration-for-theme]: https://github.com/hugo-fixit/FixIt/issues/43 [hugo-output-formats]: https://gohugo.io/templates/output-formats/ +[configure-taxonomies]: https://gohugo.io/content-management/taxonomies/#configure-taxonomies diff --git a/content/zh-cn/documentation/getting-started/configuration/index.md b/content/zh-cn/documentation/getting-started/configuration/index.md index ee30e17..340141f 100644 --- a/content/zh-cn/documentation/getting-started/configuration/index.md +++ b/content/zh-cn/documentation/getting-started/configuration/index.md @@ -134,6 +134,120 @@ menu: --- ``` +## 解析配置 {#markup-configuration} + +通过根配置键 `markup` 配置将标记语言转为 HTML。 + +本节仅记录**FixIt**主题的一些 [必要配置][necessary-configuration-for-theme]。有关更多详细信息,请参阅 [Configure markup][configuration-markup] 页面。 + +```toml +[markup] + [markup.highlight] + codeFences = true + lineNos = true + lineNumbersInTable = true + noClasses = false +``` + +## 分类法配置 {#taxonomies-configuration} + +FixIt 主题内置了三个维度的 [分类法][configure-taxonomies]:分类、标签和合集。主题默认 `taxonomies` 配置如下: + +```toml +[taxonomies] + category = "categories" + tag = "tags" + collection = "collections" +``` + +如果你希望 `taxonomies` 配置始终保持和主题一致,你可以设置 `taxonomies._merge` 为 `shallow`。 + +之后,你可以对文章进行分类,例如: + +```yaml +--- +title: 配置 FixIt +date: 2024-03-07T15:37:59+08:00 +tags: + - Configuration + - Installation + - Basics +categories: + - Documentation +collections: + - Getting Started +--- +``` + +## 自定义输出格式 + +Hugo 可以输出多种格式的内容,**FixIt** 主题利用了这个功能。为了完全配置主题,请将以下选项配置到 `hugo.toml` 中。 + +有关输出格式配置的更多详细信息,请参阅 [自定义输出格式][hugo-output-formats] 页面。 + +```toml +[mediaTypes] + [mediaTypes."text/markdown"] + suffixes = ["md"] + +[outputFormats] + # {{< version 0.3.0 >}} 用于输出 /archives/index.html 文件的设置 + [outputFormats.archives] + path = "archives" + baseName = "index" + mediaType = "text/html" + isPlainText = false + isHTML = true + permalinkable = true + # {{< version 0.3.0 >}} 用于输出 /offline/index.html 文件的设置 + [outputFormats.offline] + path = "offline" + baseName = "index" + mediaType = "text/html" + isPlainText = false + isHTML = true + permalinkable = true + # {{< version 0.3.0 >}} 用于输出 readme.md 文件的设置 + [outputFormats.readme] + baseName = "readme" + mediaType = "text/markdown" + isPlainText = true + isHTML = false + # {{< version 0.3.0 changed >}} 用于输出 baidu_urls.txt 文件的设置 + [outputFormats.baidu_urls] + baseName = "baidu_urls" + mediaType = "text/plain" + isPlainText = true + isHTML = false + # {{< version 0.3.10 >}} 用于输出 search.json 文件的设置 + [outputFormats.search] + baseName = "search" + mediaType = "application/json" + rel = "search" + isPlainText = true + isHTML = false + permalinkable = true +``` + +基本上你无需配置 `mediaTypes` 和 `outputFormats` 的配置,因为 **FixIt** 主题已经为你配置好了。你只需要配置 `outputs` 部分即可。 + +```toml +# 用于 Hugo 输出文档的设置,可选值如下: +# home = ["html", "rss", "archives", "offline", "readme", "baidu_urls", "search"] +# page = ["html", "markdown"] +# section = ["html", "rss"] +# taxonomy = ["html"] +# term = ["html", "rss"] +[outputs] + home = ["html", "rss", "archives", "offline", "search"] + page = ["html", "markdown"] + section = ["html", "rss"] + taxonomy = ["html"] + term = ["html", "rss"] +``` + +如果你希望 `outputs` 配置始终保持和主题一致,你可以设置 `outputs._merge` 为 `shallow`。 + ## 主题配置 {#theme-configuration} 除了 Hugo 全局配置外,FixIt 还通过根配置键 `params` 提供了一些主题配置。 @@ -1511,92 +1625,6 @@ mDevtools ``` -## 解析配置 {#markup-configuration} - -通过根配置键 `markup` 配置将标记语言转为 HTML。 - -本节仅记录**FixIt**主题的一些 [必要配置][necessary-configuration-for-theme]。有关更多详细信息,请参阅 [Configure markup][configuration-markup] 页面。 - -```toml -[markup] - [markup.highlight] - codeFences = true - lineNos = true - lineNumbersInTable = true - noClasses = false -``` - -## 自定义输出格式 - -Hugo 可以输出多种格式的内容,**FixIt** 主题利用了这个功能。为了完全配置主题,请将以下选项配置到 `hugo.toml` 中。 - -有关输出格式配置的更多详细信息,请参阅 [自定义输出格式][hugo-output-formats] 页面。 - -```toml -[mediaTypes] - [mediaTypes."text/markdown"] - suffixes = ["md"] - -[outputFormats] - # {{< version 0.3.0 >}} 用于输出 /archives/index.html 文件的设置 - [outputFormats.archives] - path = "archives" - baseName = "index" - mediaType = "text/html" - isPlainText = false - isHTML = true - permalinkable = true - # {{< version 0.3.0 >}} 用于输出 /offline/index.html 文件的设置 - [outputFormats.offline] - path = "offline" - baseName = "index" - mediaType = "text/html" - isPlainText = false - isHTML = true - permalinkable = true - # {{< version 0.3.0 >}} 用于输出 readme.md 文件的设置 - [outputFormats.readme] - baseName = "readme" - mediaType = "text/markdown" - isPlainText = true - isHTML = false - # {{< version 0.3.0 changed >}} 用于输出 baidu_urls.txt 文件的设置 - [outputFormats.baidu_urls] - baseName = "baidu_urls" - mediaType = "text/plain" - isPlainText = true - isHTML = false - # {{< version 0.3.10 >}} 用于输出 search.json 文件的设置 - [outputFormats.search] - baseName = "search" - mediaType = "application/json" - rel = "search" - isPlainText = true - isHTML = false - permalinkable = true -``` - -基本上你无需配置 `mediaTypes` 和 `outputFormats` 的配置,因为 **FixIt** 主题已经为你配置好了。你只需要配置 `outputs` 部分即可。 - -```toml -# 用于 Hugo 输出文档的设置,可选值如下: -# home = ["html", "rss", "archives", "offline", "readme", "baidu_urls", "search"] -# page = ["html", "markdown"] -# section = ["html", "rss"] -# taxonomy = ["html"] -# term = ["html", "rss"] -[outputs] - home = ["html", "rss", "archives", "offline", "search"] - page = ["html", "markdown"] - section = ["html", "rss"] - taxonomy = ["html"] - term = ["html", "rss"] -``` - -{{< admonition tip >}} -如果你希望 `outputs` 配置始终保持和主题一致,你可以设置 `outputs._merge` 为 `shallow`。 -{{< /admonition >}} - ## Favicon 生成 强烈建议你把你自己的网站图标,`browserconfig.xml` 和 `site.webmanifest` 文件放在 `/static` 目录。 @@ -1631,3 +1659,4 @@ Hugo 可以输出多种格式的内容,**FixIt** 主题利用了这个功能 [configuration-markup]: https://gohugo.io/getting-started/configuration-markup/ [necessary-configuration-for-theme]: https://github.com/hugo-fixit/FixIt/issues/43 [hugo-output-formats]: https://gohugo.io/templates/output-formats/ +[configure-taxonomies]: https://gohugo.io/content-management/taxonomies/#configure-taxonomies