diff --git a/docs/sources/write/front-matter/index.md b/docs/sources/write/front-matter/index.md index 6365570b1..240afb8cb 100644 --- a/docs/sources/write/front-matter/index.md +++ b/docs/sources/write/front-matter/index.md @@ -165,6 +165,20 @@ For example, `https://grafana.com/docs/writers-toolkit/`. For content reused in Grafana Cloud, prefer the open source documentation as the canonical page. +### Cascade + +`cascade` is a map of front matter keys. The values are passed down from the parent to the page descendants. + +You can use `cascade` to define variables. For example: + +``` +cascade: + PRODUCT_VERSION: 10.1 + PRODUCT_NAME: Grafana +``` + +Use the [param](https://grafana.com/docs/writers-toolkit/write/shortcodes#param) shortcode in the topic body text wherever you need to insert the variable. + ### Date `date` describes the initial publish date of the page. diff --git a/docs/sources/write/shortcodes/index.md b/docs/sources/write/shortcodes/index.md index 29d4ab9b3..c9d00c58e 100644 --- a/docs/sources/write/shortcodes/index.md +++ b/docs/sources/write/shortcodes/index.md @@ -381,6 +381,43 @@ In this example, the image's display size is changed to have a maximum width of {{}} ``` + + + +## Param + + + +The `param` shortcode provides build-time variable substitution. + +To add a new variable definition: + +1. Define a [`cascade` variable](https://grafana.com/docs/writers-toolkit/write/front-matter/#cascade) in the parent topic. +1. Insert the `param` variable where it's required in the parent and child topics. + +> **Note:** If you use the `param` shortcode in headings, you must use `%` in place of `<` and `>`. For example: `{{%/* param VARIABLE */%}}`. + +### Example + +The front matter definition for a product version: + +```markdown +cascade: + PRODUCT_VERSION: 10.2 +``` + +The `param` shortcode in the topic body text: + +```markdown +Welcome to Grafana {{}}! Read on to learn about changes to dashboards and visualizations, data sources, security and authentication, and more. +``` + +The `param` shortcode in a topic heading: + +```markdown +## What's new in Grafana {{%/* param PRODUCT_VERSION */%}}. +``` + ## Relref