Skip to content

Commit 55263c7

Browse files
chore: update academy shortcode usage to match latest theme
Signed-off-by: Aastha <bhat.aasthaa@gmail.com>
1 parent d0c3053 commit 55263c7

13 files changed

Lines changed: 179 additions & 98 deletions

File tree

content/content-formatting-examples/academy-theme/chapterstyle/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ draft: true
99
The `chapterstyle` shortcode wraps content in a `<div>` with custom inline styles, useful for visually distinguishing chapter or section blocks.
1010

1111
```text
12-
{{%/* chapterstyle style="padding: 1rem; border: 1px solid #d0d7de; border-radius: 0.75rem; background: #f8fafc;" */%}}
12+
{{</* chapterstyle style="padding: 1rem; border: 1px solid #d0d7de; border-radius: 0.75rem; background: #f8fafc;" */>}}
1313
Your styled content here.
14-
{{%/* /chapterstyle */%}}
14+
{{</* /chapterstyle */>}}
1515
```
1616

1717
**Parameters:**
@@ -22,6 +22,6 @@ Your styled content here.
2222

2323
**Example:**
2424

25-
{{% chapterstyle style="padding: 1rem; border: 1px solid #d0d7de; border-radius: 0.75rem; background: #f8fafc;" %}}
25+
{{< chapterstyle style="padding: 1rem; border: 1px solid #d0d7de; border-radius: 0.75rem; background: #f8fafc;" >}}
2626
This content is wrapped by the `chapterstyle` shortcode. The border, padding, and background color are applied via the `style` parameter. This shortcode is useful for visually grouping related content into a styled container.
27-
{{% /chapterstyle %}}
27+
{{< /chapterstyle >}}

content/content-formatting-examples/academy-theme/csvtable-roles/_index.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@ description: Academy theme csvtable-roles shortcode for role-specific permission
66
draft: true
77
---
88

9-
The `csvtable-roles` shortcode reads `static/data/csv/keys-backup.csv` and renders per-role permission tables showing which functions each role has access to.
9+
The `csvtable-roles` shortcode turns a role permissions matrix into per-role reference tables, so the permissions stay in one CSV instead of hand-maintained markdown that drifts out of sync. It reads every role column and renders a table per role , listing only the permissions that role holds — giving readers a single view of what one role can do.
1010

1111
```text
12-
{{</* csvtable-roles */>}}
12+
{{</* csvtable-roles src="keys-backup.csv" */>}}
1313
```
1414

15-
The CSV file must be located at `static/data/csv/keys-backup.csv` with the same format used by `csvtable`.
15+
**Parameters:**
16+
17+
| Parameter | Description | Default |
18+
|---|---|---|
19+
| `src` | Path to the CSV. Resolved against the page bundle first, then `assets/`, then the project root | `static/data/csv/keys-backup.csv` |
20+
| `headerRow` | 0-based index of the header row. Set to `1` for a CSV with a title row above the header | `0` |
21+
22+
**Example:**
23+
24+
{{< csvtable-roles src="keys-backup.csv" >}}
25+
26+
The CSV needs `Function` and `Feature` columns and one column per role. Every column that isn't `Category`, `Function`, `Feature`, or metadata (`Keychain ID`, `Key ID`, `Inserted`, `Local Provider`) is treated as a role, and a row appears under that role when its cell is `X` or `X*`.
27+
28+
Paths for `assets/` are relative to that directory (`data/keys.csv`), while project-root paths keep their prefix (`static/data/csv/keys-backup.csv`).

content/content-formatting-examples/academy-theme/csvtable/_index.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ description: Academy theme csvtable shortcode for rendering permissions tables f
66
draft: true
77
---
88

9-
The `csvtable` shortcode reads `static/data/csv/keys-backup.csv` and renders a permissions table grouped by category. Each role column shows a check or cross indicator.
10-
9+
The `csvtable` shortcode turns a role permissions matrix into documentation tables, so the permissions stay in one CSV instead of hand-maintained markdown that drifts out of sync. It groups rows by their `Category` column and renders a table per category, with every role as a column — giving readers a feature-by-feature comparison of role access.
1110
```text
12-
{{</* csvtable */>}}
11+
{{</* csvtable src="keys-backup.csv" */>}}
1312
```
1413

15-
The CSV file must be located at `static/data/csv/keys-backup.csv` and contain columns for Category, Function, Feature, and various role names.
14+
**Parameters:**
15+
16+
| Parameter | Description | Default |
17+
|-----------|-------------|---------|
18+
| `src` | Path to the CSV. Resolved against the page bundle first, then `assets/`, then the project root | `static/data/csv/keys-backup.csv` |
19+
| `headerRow` | 0-based index of the header row. Set to `1` for a CSV with a title row above the header | `0` |
20+
21+
**Example:**
22+
23+
{{< csvtable src="keys-backup.csv" >}}
24+
25+
The CSV needs a `Category` column, `Function` and `Feature` columns, and one column per role. `Keychain ID`, `Key ID`, `Inserted`, and `Local Provider` are hidden if present. Role cells render `X` as ✅, `X*` as ✅ *, and anything else as ❌.
26+
27+
Paths for `assets/` are relative to that directory (`data/keys.csv`), while project-root paths keep their prefix (`static/data/csv/keys-backup.csv`).

content/content-formatting-examples/academy-theme/lab-intro/_index.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ description: Academy theme lab-intro shortcode for storing lab introduction cont
66
draft: true
77
---
88

9-
The `lab-intro` shortcode captures its inner content and stores it on the page scratch pad under the key `lab_intro`. This allows layout templates to retrieve and display lab introduction text in a dedicated section of the page.
9+
The `lab-intro` shortcode captures its inner content and stores it for output elsewhere on the page , so lab introductions can be authored inline with the rest of the lab while rendering in a dedicated section . It emits nothing at the call site — the stored content is rendered by `lab-outro`, which must appear later in the same file.
1010

1111
```text
12-
{{%/* lab-intro */%}}
13-
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud native application using Kubernetes. By the end of this lab, you will be able to create a cluster, deploy workloads, and expose services.
14-
{{%/* /lab-intro */%}}
12+
{{</* lab-intro */>}}
13+
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud-native application using Kubernetes. By the end of this lab, you will be able to create a cluster, deploy workloads, and expose services.
14+
{{</* /lab-intro */>}}
15+
16+
{{</* lab-outro */>}}
1517
```
1618

1719
**Example:**
1820

19-
{{% lab-intro %}}
20-
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud native application using Kubernetes. By the end of this lab, you will be able to create a cluster, deploy workloads, and expose services.
21-
{{% /lab-intro %}}
21+
{{< lab-intro >}}
22+
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud-native application using Kubernetes. By the end of this lab, you will be able to create a cluster, deploy workloads, and expose services.
23+
{{< /lab-intro >}}
2224

23-
The content above is stored in the page's scratch pad. Layout templates can access it via `.Page.Scratch.Get "lab_intro"` to render it in a dedicated area.
25+
{{< lab-outro >}}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Lab Outro
3+
linkTitle: Lab Outro
4+
weight: 11
5+
description: Academy theme lab-outro shortcode for rendering lab introduction content.
6+
draft: true
7+
---
8+
9+
The `lab-outro` shortcode renders the content captured earlier by `lab-intro`, marking the point on the page where that content should appear.
10+
11+
```text
12+
{{</* lab-intro */>}}
13+
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud-native application using Kubernetes.
14+
{{</* /lab-intro */>}}
15+
16+
{{</* lab-outro */>}}
17+
```
18+
19+
**Example:**
20+
21+
{{< lab-intro >}}
22+
Welcome to this hands-on lab. In this exercise, you will learn how to deploy a cloud-native application using Kubernetes.
23+
{{< /lab-intro >}}
24+
25+
{{< lab-outro >}}
26+
27+
Shortcodes run in source order, so `lab-outro` must appear after the `lab-intro` it renders. Calling it first logs a build warning and outputs nothing. Only one capture is stored per page, so a second `lab-intro` overwrites the first.

content/content-formatting-examples/academy-theme/svg/_index.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@
22
title: SVG
33
linkTitle: SVG
44
weight: 7
5-
description: Academy theme svg shortcode for inline SVG icons from assets.
5+
description: Render an inline SVG icon, resolved from the page bundle first, then assets.
66
draft: true
77
---
88

9-
The `svg` shortcode renders an inline SVG icon from `assets/icons/{name}.svg`.
9+
The `svg` shortcode renders an inline SVG icon .
1010

1111
```text
12-
{{</* svg name="layer5-academy-icon" */>}}
12+
{{</* svg name="exoscale-icon" */>}}
13+
{{</* svg src="1e2a8e46-937c-47ea-ab43-5716e3bcab2e/icons/foo.svg" */>}}
1314
```
1415

1516
**Parameters:**
1617

1718
| Parameter | Description | Default |
1819
|-----------|-------------|---------|
19-
| `name` | SVG file name (without extension) from `assets/icons/` | _(required)_ |
20+
| `name` | SVG file name (without extension). Looks for `{name}.svg` in the page bundle, then `assets/icons/{name}.svg` | _(required, unless `src` is set)_ |
21+
| `src` | Explicit path including the extension, resolved against the page bundle, then `assets/`. Takes precedence over `name` | _(none)_ |
2022

2123
**Example:**
2224

23-
<!-- The icon renders inline: {{< svg name="exoscale-icon" >}} -->
25+
The icon renders inline: {{< svg name="exoscale-icon" >}}
2426

25-
To add your own SVG icons, place `.svg` files in the `assets/icons/` directory.
27+
To add your own SVG icons, place `.svg` files in the `assets/icons/` directory, or alongside `index.md` in a page bundle to keep them with the page that uses them.
28+
29+
Use `src` when the file lives outside `assets/icons/` — for example an org-scoped directory like `assets/{org-id}/icons/`. When resolved from `assets/`, paths are relative to `assets/`, so leave that prefix off: a file at `assets/1e2a8e46-937c-47ea-ab43-5716e3bcab2e/icons/foo.svg` is referenced as `src="1e2a8e46-937c-47ea-ab43-5716e3bcab2e/icons/foo.svg"`. When resolved from the page bundle, `src` is relative to the page bundle itself. A build warning is logged if the file is found in neither location.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: SwaggerUI API
3+
linkTitle: SwaggerUI API
4+
weight: 11
5+
description: Render the Academy Theme swaggerui-api shortcode.
6+
draft: true
7+
---
8+
9+
The `swaggerui-api` shortcode renders an interactive Swagger UI viewer for an OpenAPI spec.
10+
11+
```text
12+
{{</* swaggerui-api src="example.json" */>}}
13+
{{</* swaggerui-api src="/data/openapi.json" */>}}
14+
```
15+
16+
**Parameters:**
17+
18+
| Parameter | Description | Default |
19+
|-----------|-------------|---------|
20+
| `src` | Path to the OpenAPI spec. Root-relative paths (files under `static/`) are used as-is; anything else resolves against the page bundle, then `assets/` | _(required)_ |
21+
| `deepLinking` | `"true"` writes the expanded operation into the URL fragment. Only safe with one viewer per page | `"false"` |
22+
23+
**Example:**
24+
25+
{{< swaggerui-api src="example.json" >}}
26+
27+
Place the spec alongside `index.md` in a page bundle to keep it with the page that uses it, or in `assets/` to share it across pages. The spec must be part of this site — remote URLs are rejected at build time.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Example Academy API",
5+
"version": "1.0.0",
6+
"description": "A sample API specification for demonstrating the Redoc and SwaggerUI shortcodes."
7+
},
8+
"paths": {
9+
"/api/courses": {
10+
"get": {
11+
"summary": "List courses",
12+
"description": "Returns a list of all available courses.",
13+
"responses": {
14+
"200": {
15+
"description": "A list of courses.",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/components/schemas/Course"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
29+
},
30+
"/api/courses/{id}": {
31+
"get": {
32+
"summary": "Get a course",
33+
"description": "Returns a single course by ID.",
34+
"parameters": [
35+
{
36+
"name": "id",
37+
"in": "path",
38+
"required": true,
39+
"schema": { "type": "string" }
40+
}
41+
],
42+
"responses": {
43+
"200": {
44+
"description": "A course object.",
45+
"content": {
46+
"application/json": {
47+
"schema": { "$ref": "#/components/schemas/Course" }
48+
}
49+
}
50+
},
51+
"404": { "description": "Course not found." }
52+
}
53+
}
54+
}
55+
},
56+
"components": {
57+
"schemas": {
58+
"Course": {
59+
"type": "object",
60+
"properties": {
61+
"id": { "type": "string", "example": "cloud-101" },
62+
"title": { "type": "string", "example": "Cloud Fundamentals" },
63+
"description": { "type": "string", "example": "An introduction to cloud computing concepts." },
64+
"duration": { "type": "string", "example": "2 hours" }
65+
}
66+
}
67+
}
68+
}
69+
}

content/content-formatting-examples/academy-theme/usestatic/_index.md

Lines changed: 0 additions & 15 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)