1+ {{- $title := .Get "title" -}}
2+ {{- $titleUrl := .Get "titleUrl" | default "/" -}}
3+ {{- $icon := .Get "icon" | default "NGINX-product-icon" -}}
14{{- $current := .Page.Scratch.Get "cards" | default (slice) -}}
2- {{- $newCard := dict "title" (.Get " title" ) "content" (.Inner) -}}
5+ {{- $newCard := dict "title" ($ title) "content" (.Inner) -}}
36{{- .Page.Scratch.Set "cards" ($current | append $newCard) -}}
47{{- /* Validate that the parent is card-section */ -}}
5- {{ if eq .Parent.Name "card-section"}}
8+ {{- if eq .Parent.Name "card-section" - }}
69 < 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 >
1013 {{- else -}}
11- < h2 class ="card-title "> {{- .Get " title" -}}</ h2 >
14+ < h2 class ="card-title "> {{- $ title -}}</ h2 >
1215 {{- end -}}
13- {{ end }}
16+ {{- else -}}
17+ {{ errorf "Mainframe: Missing param 'title'" }}
18+ {{- end -}}
1419 < p > {{- .Inner -}}</ p >
1520 </ div >
1621 < div class ="col-md-5 card " data-mf ="false ">
1722 < div class ="card-body ">
1823 < 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'" }}
2131 {{- end -}}
22- < a href ="{{- .Get "titleUrl " -}}"> {{- .Get "title" -}}</ a >
2332 </ h3 >
2433 < p > {{- .Inner -}}</ p >
2534 </ div >
2635 </ div >
27- {{ else }}
36+ {{- else - }}
2837 {{ 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