Skip to content

Commit 292d508

Browse files
committed
Card: Handle case of no inner for cards
1 parent eede269 commit 292d508

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

layouts/shortcodes/card.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
{{- $isLanding := cond (eq $isLandingParam "true") "true" "false" -}}
1818

1919
{{- /* Set up the positioning */ -}}
20-
{{ $dataGrid := "" }}
21-
{{ if eq $isFullSize "true" }}
22-
{{ $dataGrid = "wide"}}
23-
{{ else if (eq $isLanding "true") }}
24-
{{ $dataGrid = "third"}}
25-
{{ else }}
26-
{{ $dataGrid = "half"}}
27-
{{ end }}
20+
{{- $dataGrid := "" -}}
21+
{{- if eq $isFullSize "true" -}}
22+
{{- $dataGrid = "wide" -}}
23+
{{- else if (eq $isLanding "true") -}}
24+
{{- $dataGrid = "third" -}}
25+
{{- else -}}
26+
{{- $dataGrid = "half" -}}
27+
{{- end -}}
2828

2929
{{- /* Build the url */ -}}
30-
{{ $url := printf "%s%s" .Page.Permalink $titleUrl }}
31-
{{ if eq (substr $titleUrl 0 1) "/" }}
32-
{{ $url = printf "%s%s" .Site.BaseURL (substr $titleUrl 1) }}
33-
{{ else if (strings.Contains $titleUrl "https") }}
34-
{{ $url = $titleUrl }}
35-
{{ end }}
30+
{{- $url := printf "%s%s" .Page.Permalink $titleUrl -}}
31+
{{- if eq (substr $titleUrl 0 1) "/" -}}
32+
{{- $url = printf "%s%s" .Site.BaseURL (substr $titleUrl 1) -}}
33+
{{- else if (strings.Contains $titleUrl "https") -}}
34+
{{- $url = $titleUrl -}}
35+
{{- end -}}
3636

3737
{{- /* Validate that the parent is card-section and under 3 cards */ -}}
3838
{{- if (eq .Parent.Name "card-section") -}}
@@ -50,7 +50,9 @@ <h2 class="card-title">{{- $title -}}</h2>
5050
{{- else -}}
5151
{{ errorf "Mainframe: Missing param 'title'" }}
5252
{{- end -}}
53-
<div class="card-content">{{ .Inner }}</div>
53+
{{- with .Inner -}}
54+
<div class="card-content">{{ . }}</div>
55+
{{- end -}}
5456
</div>
5557
</a>
5658
{{- else -}}

0 commit comments

Comments
 (0)