Skip to content

Commit 7d0e235

Browse files
committed
Add shortcode doc
1 parent 216b34a commit 7d0e235

File tree

1 file changed

+27
-0
lines changed
  • content/en/docs/contribute/style/hugo-shortcodes

1 file changed

+27
-0
lines changed

content/en/docs/contribute/style/hugo-shortcodes/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,33 @@ You can also include a full definition:
8383
which renders as:
8484
{{< glossary_definition term_id="cluster" length="all" >}}
8585

86+
## Links to API Reference
87+
88+
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:
89+
90+
```
91+
{{</* api-reference page="workload-resources/pod-v1" */>}}
92+
```
93+
94+
The content of the `page` parameter is the suffix of the URL of the API reference page.
95+
96+
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:
98+
99+
```
100+
{{</* api-reference page="workload-resources/pod-v1" anchor="PodSpec" */>}}
101+
{{</* api-reference page="workload-resources/pod-v1" anchor="environment-variables" */>}}
102+
```
103+
104+
105+
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:
106+
107+
```
108+
{{</* api-reference page="workload-resources/pod-v1" anchor="environment-variables" text="Environment Variable" */>}}
109+
```
110+
111+
112+
86113
## Table captions
87114

88115
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.

0 commit comments

Comments
 (0)