You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/contribute/style/hugo-shortcodes/index.md
+59-24Lines changed: 59 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,13 @@ Read more about shortcodes in the [Hugo documentation](https://gohugo.io/content
12
12
13
13
## Feature state
14
14
15
-
In a Markdown page (`.md` file) on this site, you can add a shortcode to display version and state of the documented feature.
15
+
In a Markdown page (`.md` file) on this site, you can add a shortcode to
16
+
display version and state of the documented feature.
16
17
17
18
### Feature state demo
18
19
19
-
Below is a demo of the feature state snippet, which displays the feature as stable in the latest Kubernetes version.
20
+
Below is a demo of the feature state snippet, which displays the feature as
21
+
stable in the latest Kubernetes version.
20
22
21
23
```
22
24
{{</* feature-state state="stable" */>}}
@@ -50,16 +52,22 @@ Renders to:
50
52
51
53
There are two glossary shortcodes: `glossary_tooltip` and `glossary_definition`.
52
54
53
-
You can reference glossary terms with an inclusion that automatically updates and replaces content with the relevant links from [our glossary](/docs/reference/glossary/). When the glossary term is moused-over, the glossary entry displays a tooltip. The glossary term also displays as a link.
55
+
You can reference glossary terms with an inclusion that automatically updates
56
+
and replaces content with the relevant links from [our glossary](/docs/reference/glossary/).
57
+
When the glossary term is moused-over, the glossary entry displays a tooltip.
58
+
The glossary term also displays as a link.
54
59
55
60
As well as inclusions with tooltips, you can reuse the definitions from the glossary in
56
61
page content.
57
62
58
-
The raw data for glossary terms is stored at [https://github.com/kubernetes/website/tree/main/content/en/docs/reference/glossary](https://github.com/kubernetes/website/tree/main/content/en/docs/reference/glossary), with a content file for each glossary term.
You can link to a page of the Kubernetes API reference using the `api-reference` shortcode, for example to the {{< api-reference page="workload-resources/pod-v1" >}} reference:
96
+
You can link to a page of the Kubernetes API reference using the
@@ -94,25 +104,31 @@ You can link to a page of the Kubernetes API reference using the `api-reference`
94
104
The content of the `page` parameter is the suffix of the URL of the API reference page.
95
105
96
106
97
-
You can link to a specific place into a page by specifying an `anchor` parameter, for example to the {{< api-reference page="workload-resources/pod-v1" anchor="PodSpec" >}} reference or the {{< api-reference page="workload-resources/pod-v1" anchor="environment-variables" >}} section of the page:
107
+
You can link to a specific place into a page by specifying an `anchor`
108
+
parameter, for example to the {{< api-reference page="workload-resources/pod-v1" anchor="PodSpec" >}}
109
+
reference or the {{< api-reference page="workload-resources/pod-v1" anchor="environment-variables" >}}
You can change the text of the link by specifying a `text` parameter, for example by linking to the {{< api-reference page="workload-resources/pod-v1" anchor="environment-variables" text="Environment Variables">}} section of the page:
118
+
You can change the text of the link by specifying a `text` parameter, for
You can make tables more accessible to screen readers by adding a table caption. To add a [caption](https://www.w3schools.com/tags/tag_caption.asp) to a table, enclose the table with a `table` shortcode and specify the caption with the `caption` parameter.
129
+
You can make tables more accessible to screen readers by adding a table caption. To add a
130
+
[caption](https://www.w3schools.com/tags/tag_caption.asp) to a table,
131
+
enclose the table with a `table` shortcode and specify the caption with the `caption` parameter.
116
132
117
133
{{< note >}}
118
134
Table captions are visible to screen readers but invisible when viewed in standard HTML.
In a markdown page (`.md` file) on this site, you can add a tab set to display multiple flavors of a given solution.
166
+
In a markdown page (`.md` file) on this site, you can add a tab set to display
167
+
multiple flavors of a given solution.
150
168
151
169
The `tabs` shortcode takes these parameters:
152
170
153
171
*`name`: The name as shown on the tab.
154
-
*`codelang`: If you provide inner content to the `tab` shortcode, you can tell Hugo what code language to use for highlighting.
155
-
*`include`: The file to include in the tab. If the tab lives in a Hugo [leaf bundle](https://gohugo.io/content-management/page-bundles/#leaf-bundles), the file -- which can be any MIME type supported by Hugo -- is looked up in the bundle itself. If not, the content page that needs to be included is looked up relative to the current page. Note that with the `include`, you do not have any shortcode inner content and must use the self-closing syntax. For example, <code>{{</* tab name="Content File #1" include="example1" /*/>}}</code>. The language needs to be specified under `codelang` or the language is taken based on the file name. Non-content files are code-highlighted by default.
156
-
* If your inner content is markdown, you must use the `%`-delimiter to surround the tab. For example, `{{%/* tab name="Tab 1" %}}This is **markdown**{{% /tab */%}}`
172
+
*`codelang`: If you provide inner content to the `tab` shortcode, you can tell Hugo
173
+
what code language to use for highlighting.
174
+
*`include`: The file to include in the tab. If the tab lives in a Hugo
the file -- which can be any MIME type supported by Hugo -- is looked up in the bundle itself.
177
+
If not, the content page that needs to be included is looked up relative to the current page.
178
+
Note that with the `include`, you do not have any shortcode inner content and must use the
179
+
self-closing syntax. For example,
180
+
`{{</* tab name="Content File #1" include="example1" /*/>}}`. The language needs to be specified
181
+
under `codelang` or the language is taken based on the file name.
182
+
Non-content files are code-highlighted by default.
183
+
* If your inner content is markdown, you must use the `%`-delimiter to surround the tab.
184
+
For example, `{{%/* tab name="Tab 1" %}}This is **markdown**{{% /tab */%}}`
157
185
* You can combine the variations mentioned above inside a tab set.
158
186
159
187
Below is a demo of the tabs shortcode.
@@ -288,13 +316,17 @@ The two most commonly used version parameters are `latest` and `version`.
288
316
289
317
### `{{</* param "version" */>}}`
290
318
291
-
The `{{</* param "version" */>}}` shortcode generates the value of the current version of
292
-
the Kubernetes documentation from the `version` site parameter. The `param` shortcode accepts the name of one site parameter, in this case: `version`.
319
+
The `{{</* param "version" */>}}` shortcode generates the value of the current
320
+
version of the Kubernetes documentation from the `version` site parameter. The
321
+
`param` shortcode accepts the name of one site parameter, in this case:
322
+
`version`.
293
323
294
324
{{< note >}}
295
-
In previously released documentation, `latest` and `version` parameter values are not equivalent.
296
-
After a new version is released, `latest` is incremented and the value of `version` for the documentation set remains unchanged. For example, a previously released version of the documentation displays `version` as
297
-
`v1.19` and `latest` as `v1.20`.
325
+
In previously released documentation, `latest` and `version` parameter values
326
+
are not equivalent. After a new version is released, `latest` is incremented
327
+
and the value of `version` for the documentation set remains unchanged. For
328
+
example, a previously released version of the documentation displays `version`
329
+
as `v1.19` and `latest` as `v1.20`.
298
330
{{< /note >}}
299
331
300
332
Renders to:
@@ -313,7 +345,8 @@ Renders to:
313
345
314
346
### `{{</* latest-semver */>}}`
315
347
316
-
The `{{</* latest-semver */>}}` shortcode generates the value of `latest` without the "v" prefix.
348
+
The `{{</* latest-semver */>}}` shortcode generates the value of `latest`
349
+
without the "v" prefix.
317
350
318
351
Renders to:
319
352
@@ -330,8 +363,9 @@ Renders to:
330
363
331
364
### `{{</* latest-release-notes */>}}`
332
365
333
-
The `{{</* latest-release-notes */>}}` shortcode generates a version string from `latest` and removes
334
-
the "v" prefix. The shortcode prints a new URL for the release note CHANGELOG page with the modified version string.
366
+
The `{{</* latest-release-notes */>}}` shortcode generates a version string
367
+
from `latest` and removes the "v" prefix. The shortcode prints a new URL for
368
+
the release note CHANGELOG page with the modified version string.
335
369
336
370
Renders to:
337
371
@@ -344,3 +378,4 @@ Renders to:
344
378
* Learn about [page content types](/docs/contribute/style/page-content-types/).
345
379
* Learn about [opening a pull request](/docs/contribute/new-content/open-a-pr/).
346
380
* Learn about [advanced contributing](/docs/contribute/advanced/).
0 commit comments