From 603ce4c421dcdad50780df09f4a6960613a4e60a Mon Sep 17 00:00:00 2001 From: Li Yuan Date: Sun, 16 Dec 2018 19:40:39 +0800 Subject: [PATCH] zh-trans: /docs/contribute/style/page-templates.md (#11672) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李元10098251 zh-trans: /docs/contribute/style/page-templates.md; update Signed-off-by: 李元10098251 zh-trans: /docs/contribute/style/page-templates.md; update2 Signed-off-by: 李元10098251 zh-trans: /docs/contribute/style/page-templates.md; update3 Signed-off-by: 李元10098251 zh-trans: /docs/contribute/style/page-templates.md; update4 Signed-off-by: 李元10098251 --- .../style/hugo-shortcodes/example1.md | 23 ++ .../style/hugo-shortcodes/example2.md | 17 + .../docs/contribute/style/page-templates.md | 352 ++++++++++++++++++ 3 files changed, 392 insertions(+) create mode 100644 content/zh/docs/contribute/style/hugo-shortcodes/example1.md create mode 100644 content/zh/docs/contribute/style/hugo-shortcodes/example2.md create mode 100644 content/zh/docs/contribute/style/page-templates.md diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/example1.md b/content/zh/docs/contribute/style/hugo-shortcodes/example1.md new file mode 100644 index 0000000000..0656ce4883 --- /dev/null +++ b/content/zh/docs/contribute/style/hugo-shortcodes/example1.md @@ -0,0 +1,23 @@ +--- +title: 例子 #1 +--- + + + + + +这是一个内容文件**示例**,位于一个**includes**叶子包中。 + +{{< note >}} + + +包含的内容文件也可以包含短代码。 +{{< /note >}} \ No newline at end of file diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/example2.md b/content/zh/docs/contribute/style/hugo-shortcodes/example2.md new file mode 100644 index 0000000000..356983f3c0 --- /dev/null +++ b/content/zh/docs/contribute/style/hugo-shortcodes/example2.md @@ -0,0 +1,17 @@ +--- +title: 例子 #1 +--- + + + + + +这是另一个内容文件**示例**,位于一个**includes**叶子包中。 + + diff --git a/content/zh/docs/contribute/style/page-templates.md b/content/zh/docs/contribute/style/page-templates.md new file mode 100644 index 0000000000..f1afdff427 --- /dev/null +++ b/content/zh/docs/contribute/style/page-templates.md @@ -0,0 +1,352 @@ +--- +title: 使用页面模板 +content_template: templates/concept +weight: 30 +--- + + + +{{% capture overview %}} + + + +当贡献新主题时,选择下列模板中的一种。 +这使指定页面的用户体验标准化。 + + + +页面模板在 [`kubernetes/website`](https://github.com/kubernetes/website) 仓库的 [`layouts/partials/templates`](https://git.k8s.io/website/layouts/partials/templates) 目录中。 + +{{< note >}} + + +每个新主题都需要使用模板。如果你不确定新主题要使用哪个模板,请从[概念模板](#concept-template)开始。 +{{< /note >}} + + +{{% /capture %}} + + +{{% capture body %}} + + + +## 概念模板 + + + +每个概念页面负责解释 Kubernetes 的某方面。例如,概念页面可以描述 Kubernetes Deployment 对象,并解释当部署、扩展和更新时,它作为应用程序所扮演的角色。一般来说,概念页面不包括步骤序列,而是提供任务或教程的链接。 + + + + +要编写新的概念页面,请在 `/content/en/docs/concepts` 目录的子目录中创建一个 Markdown 文件,其特点如下: + + + +- 在页面的 YAML 头部,设置 `content_template: templates/concept`。 +- 在页面的 body 中,设置所需的 `capture` 变量和所有想要包含的变量: + + | 变量 | 必需? | + |---------------|-----------| + | overview | 是 | + | body | 是 | + | whatsnext | 否 | + + + + 页面的 body 看起来像这样(移除所有不想要的可选 `capture` 变量): + + ``` + {{%/* capture overview */%}} + + {{%/* /capture */%}} + + {{%/* capture body */%}} + + {{%/* /capture */%}} + + {{%/* capture whatsnext */%}} + + {{%/* /capture */%}} + ``` + + + +- 在每个章节中写下你的内容。请遵从以下规则: + - 使用不低于 H2 级别的标题(避免使用 H1 的标题,但 H3、H4 的标题是可以的)(以两个 `#` 字符开头)。这些章节本身是由模板自动命名的。 + - 在 `overview` 节,用一个段落的篇幅来为当前话题设定语境。 + - 在 `body` 节,使用自由形式的 Markdown 文件来解释概念。 + - 在 `whatsnext` 节,列出读者接下来可能感兴趣的最多 5 个主题。 + + + +使用概念模板的已发布主题的一个示例是[注解](/docs/concepts/overview/working-with-objects/annotations/)。你当前正在阅读的页面也使用概念模板。 + + + +## 任务模板 + + + +任务页面展示了如何完成单个任务,通常是通过给出一个简短的步骤序列。任务页面中解释性质的文字极少,但是通常会给出提供相关背景和知识的概念主题的链接。 + + + +要编写新的任务页面,请在 `/content/en/docs/tasks` 目录的子目录中创建一个 Markdown 文件,其特点如下: + + + +- 在页面的 YAML 头部,设置 `content_template: templates/task`。 +- 在页面的 body 中,设置所需的 `capture` 变量和所有想要包含的变量: + + | 变量 | 必需? | + |---------------|-----------| + | overview | 是 | + | prerequisites | 是 | + | steps | 否 | + | discussion | 否 | + | whatsnext | 否 | + + + + 页面的 body 看起来像这样(移除所有不想要的可选 `capture` 变量): + + ``` + {{%/* capture overview */%}} + + {{%/* /capture */%}} + + {{%/* capture prerequisites */%}} + + {{}} {{}} + + {{%/* /capture */%}} + + {{%/* capture steps */%}} + + {{%/* /capture */%}} + + {{%/* capture discussion */%}} + + {{%/* /capture */%}} + + {{%/* capture whatsnext */%}} + + {{%/* /capture */%}} + ``` + + + +- 在每个章节中写下你的内容。请遵从以下规则: + - 使用不低于 H2 级别的标题(避免使用 H1 的标题,但 H3、H4 的标题是可以的)(以两个 `#` 字符开头)。这些章节本身是由模板自动命名的。 + - 在 `overview` 节,用一个段落的篇幅来为当前话题设定语境。 + - 在 `prerequisites 节`,如果有可能,请使用列表。在 `include` 下开始添加额外的先决条件。默认的先决条件包括运行中的 Kubernetes 集群。 + - 在 `steps` 节,使用编号列表。 + - 在讨论部分,使用通常的内容来扩展 `steps` 中包含的信息。 + - 在 `whatsnext` 节,列出读者接下来可能感兴趣的最多 5 个主题。 + + + +使用任务模板的已发布主题的一个示例是[使用 HTTP 代理访问 Kubernetes API](/docs/tasks/access-kubernetes-api/http-proxy-access-api)。 + + + +## 教程模板 + + + +教程页面展示了如何完成比单个任务更大的目标。通常教程页有几个章节,每个章节都有步骤说明。例如,教程可以提供说明 Kubernetes 的特定特性的代码示例的演练。教程可以包括表层解释,但是应该链接到相关的概念主题以进行深入解释。 + + + +要编写新的教程页面,请在 `/content/en/docs/tutorials` 目录的子目录中创建一个 Markdown 文件,其特点如下: + + + +- 在页面的 YAML 头部,设置 `content_template: templates/tutorial`。 +- 在页面的 body 中,设置所需的 `capture` 变量和所有想要包含的变量: + + | 变量 | 必需? | + |---------------|-----------| + | overview | 是 | + | prerequisites | 是 | + | objectives | 是 | + | lessoncontent | 是 | + | cleanup | 否 | + | whatsnext | 否 | + + + + 页面的 body 看起来像这样(移除所有不想要的可选 `capture` 变量): + + ``` + {{%/* capture overview */%}} + + {{%/* /capture */%}} + + {{%/* capture prerequisites */%}} + + {{}} {{}} + + {{%/* /capture */%}} + + {{%/* capture objectives */%}} + + {{%/* /capture */%}} + + {{%/* capture lessoncontent */%}} + + {{%/* /capture */%}} + + {{%/* capture cleanup */%}} + + {{%/* /capture */%}} + + {{%/* capture whatsnext */%}} + + {{%/* /capture */%}} + ``` + + + +- 在每个章节中写下你的内容。请遵从以下规则: + - 使用不低于 H2 级别的标题(避免使用 H1 的标题,但 H3、H4 的标题是可以的)(以两个 `#` 字符开头)。这些章节本身是由模板自动命名的。 + - 在 `overview` 节,用一个段落的篇幅来为当前话题设定语境。 + - 在 `prerequisites` 节,如果有可能,请使用列表。在默认情况下添加额外的先决条件。 + - 在 `objectives` 节,使用列表。 + - 在 `lessoncontent` 节,适当地使用编号列表和叙述内容的组合。 + - 在 `cleanup` 节,使用编号列表描述完成任务后清理集群状态的步骤。 + - 在 `whatsnext` 节,列出读者接下来可能感兴趣的最多 5 个主题。 + + + +使用教程模板的已发布主题的一个示例是[使用部署运行无状态应用程序](/docs/tutorials/stateless-application/run-stateless-application-deployment/)。 + +{{% /capture %}} + +{{% capture whatsnext %}} + + + +- 学习[样式指南](/docs/contribute/style/style-guide/) +- 学习[内容组织](/docs/contribute/style/content-organization/) + +{{% /capture %}}