Skip to content

Commit f6c4616

Browse files
committed
Improve showIfParam shortcode
1 parent 2a23b6d commit f6c4616

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[show-if-param-content] {
2+
background-color: rgb(231, 248, 255);
3+
}

themes/opentermsarchive/assets/css/loader.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
@import "/components/textContent.css";
3737
@import "/components/aside.css";
3838
@import "/components/refItem.css";
39+
@import "/components/showIfParam.css";

themes/opentermsarchive/layouts/shortcodes/showIfParam.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
{{/*
2+
Shortcode: showIfParam
3+
Description: Shows content conditionally based on a URL parameter value.
4+
5+
Usage:
6+
{{% showIfParam "paramName" "expectedValue" %}}
7+
Content to show when paramName=expectedValue
8+
{{% /showIfParam %}}
9+
10+
Parameters:
11+
- paramName: The URL parameter to check (required)
12+
- expectedValue: The value to match against (optional, defaults to "true")
13+
14+
Example:
15+
{{% showIfParam "feature" "beta" %}}
16+
This content will only show when URL has ?feature=beta
17+
{{% /showIfParam %}}
18+
*/}}
19+
120
{{ $param := .Get 0 }}
221
{{ $value := .Get 1 | default "true" }}
322
{{ $content := .Inner | markdownify }}

0 commit comments

Comments
 (0)