1
+ {{- $title := .Get "title" -}}
2
+ {{- $titleUrl := .Get "titleUrl" | default "/" -}}
3
+ {{- $icon := .Get "icon" | default "NGINX-product-icon" -}}
1
4
{{- $current := .Page.Scratch.Get "cards" | default (slice) -}}
2
- {{- $newCard := dict "title" (.Get " title" ) "content" (.Inner) -}}
5
+ {{- $newCard := dict "title" ($ title) "content" (.Inner) -}}
3
6
{{- .Page.Scratch.Set "cards" ($current | append $newCard) -}}
4
7
{{- /* Validate that the parent is card-section */ -}}
5
- {{ if eq .Parent.Name "card-section"}}
8
+ {{- if eq .Parent.Name "card-section" - }}
6
9
< div class ="card-container " style ="display: none; " data-mf ="true ">
7
- {{- if .Get " title" -}}
8
- {{- if .Get " titleUrl" -}}
9
- < h2 class ="card-title "> < a href ="{{- .Get " titleUrl " -}}"> {{- .Get " title" -}}</ a > </ h2 >
10
+ {{- if $ title -}}
11
+ {{- if $ titleUrl -}}
12
+ < h2 class ="card-title "> < a href ="{{- $ titleUrl -}} "> {{- $ title -}}</ a > </ h2 >
10
13
{{- else -}}
11
- < h2 class ="card-title "> {{- .Get " title" -}}</ h2 >
14
+ < h2 class ="card-title "> {{- $ title -}}</ h2 >
12
15
{{- end -}}
13
- {{ end }}
16
+ {{- else -}}
17
+ {{ errorf "Mainframe: Missing param 'title'" }}
18
+ {{- end -}}
14
19
< p > {{- .Inner -}}</ p >
15
20
</ div >
16
21
< div class ="col-md-5 card " data-mf ="false ">
17
22
< div class ="card-body ">
18
23
< h3 class ="card-title " style ="display: flex; align-items: center; gap: 5px; ">
19
- {{- if .Get "icon" -}}
20
- < img class ="card-img-top " src ="{{ .Site.BaseURL }}/images/icons/{{ .Get "icon " }}.png"/>
24
+ {{- if $icon -}}
25
+ < img class ="card-img-top " src ="{{ .Site.BaseURL }}/images/icons/{{ $icon }}.png "/>
26
+ {{- end -}}
27
+ {{- if ($title) -}}
28
+ < a href ="{{- $titleUrl -}} "> {{- $title -}}</ a >
29
+ {{- else -}}
30
+ {{ errorf "Old theme: Missing param 'title'" }}
21
31
{{- end -}}
22
- < a href ="{{- .Get "titleUrl " -}}"> {{- .Get "title" -}}</ a >
23
32
</ h3 >
24
33
< p > {{- .Inner -}}</ p >
25
34
</ div >
26
35
</ div >
27
- {{ else }}
36
+ {{- else - }}
28
37
{{ errorf "The '< card > ' must be nested directly inside the shortcode '< card-section > '. Please see the exampleSite for an example of usage." }}
29
- {{ end }}
38
+ {{- end - }}
0 commit comments