Skip to content

Commit 999a96e

Browse files
committed
Callouts: Fixed partially styled call-outs
1 parent aad15ef commit 999a96e

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{<banner "caution" "Under development">}}
2+
<br>
3+
This product on our example site is under development and changes are being added frequently.
4+
<br>
5+
Please reach out to <strong>#friends-of-the-docs</strong> on Slack to ask questions.
6+
{{</banner>}}

exampleSite/content/test-product/_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ description: Test pages for nginx-hugo-theme
33
title: Test pages
44
weight: 100
55
nd-landing-page: true
6+
cascade:
7+
nd-banner:
8+
enabled: true
9+
start-date: 2025-01-01
10+
md: /_banners/test-product-intro.md
611
---
712
{{<card-layout>}}
813
{{<card-section showAsCards="true">}}

layouts/partials/callout.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{{ $title := .title | default "" }}
44
{{ $icon := .icon | default "" }}
55
{{ $inlineParam := .inline | default "false" | lower }}
6+
{{ $type := .type | default "" }}
67

78
{{ if not (in (slice "true" "false") $inlineParam) }}
89
{{ errorf "Invalid parameter 'inline'='%s' passed to blockquote partial from '%s'. Allowed values: true, false" $inlineParam .Page.Path }}
@@ -41,9 +42,8 @@
4142
"Deprecated" "alert-octagon"
4243
"Important" "arrow-right-circle"
4344
}}
44-
{{ $icon := index $specialTitleIcons $title | default "" }}
45-
46-
{{ $isSpecialTitle := in $specialTitles $title }}
45+
{{ $icon := index $specialTitleIcons $type | default "" }}
46+
{{ $isSpecialTitle := in $specialTitles $type }}
4747
{{ if $isSpecialTitle }}
4848
{{/* Loud callouts */}}
4949
<div>

layouts/shortcodes/banner.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{{- $type := .Get 0 | default (.Get "type") | default "" -}}
22
{{- $title := .Get 1 | default (.Get "title") | default "" -}}
33
{{ partial "callout.html" (dict
4-
"class" $type
4+
"class" (printf "%s %s" $type "call-out")
55
"title" $title
66
"icon" "fa-solid fa-triangle-exclamation"
77
"inline" true
8+
"type" ($type | strings.FirstUpper)
89
"content" .Inner
910
) }}

layouts/shortcodes/call-out.html

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
*/}}
1616

17-
{{ $class := .Get 0 | default (.Get "class") | default "" }}
17+
{{ $type := .Get 0 | default (.Get "type") | default "" | strings.FirstUpper }}
1818
{{ $title := .Get 1 | default (.Get "title") | default "" }}
1919
{{ $icon := .Get 2 | default (.Get "icon") | default "" }}
2020

@@ -25,21 +25,12 @@
2525
{{ warnf "The '<call-out>' Shortcode parameter 'inline' must be 'true' or 'false', but got: '%s'. This will now default to 'false'" $inlineParam}}
2626
{{ end }}
2727

28-
{{ $inline := eq $inlineParam "true" }}
29-
30-
{{ $sideOption := "side-callout" }}
31-
{{ $inlineOption := "inline-callout" }}
32-
33-
{{ if $inline }}
34-
{{ $class = printf "%s %s" $class $inlineOption }}
35-
{{ else }}
36-
{{ $class = printf "%s %s" $class $sideOption }}
37-
{{ end }}
28+
{{ $class := printf "%s %s" ($type | lower) "call-out" }}
3829

3930
{{ partial "callout.html" (dict
4031
"class" $class
4132
"title" $title
4233
"icon" $icon
43-
"inline" $inline
34+
"type" $type
4435
"content" .Inner
4536
) }}

layouts/shortcodes/caution.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"title" "Caution"
44
"icon" ""
55
"inline" "false"
6+
"type" "Caution"
67
"content" .Inner
78
) }}

layouts/shortcodes/important.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"title" "Important"
44
"icon" ""
55
"inline" "false"
6+
"type" "Important"
67
"content" .Inner
78
) }}

layouts/shortcodes/warning.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"title" "Warning"
44
"icon" ""
55
"inline" "false"
6+
"type" "Warning"
67
"content" .Inner
78
) }}

0 commit comments

Comments
 (0)