Skip to content

Commit a8d8b5c

Browse files
authored
Card: Handle case of no inner for cards
* Card: Handle case of no inner for cards * Card: Updated test product landing page
1 parent 4c19dbe commit a8d8b5c

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

exampleSite/content/test-product/_index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ This is a compilation of all our shortcodes to show how they look, function, res
5454

5555
{{<card-layout >}}
5656
{{<card-section title="NGINX" showAsCards="true" >}}
57-
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" >}}
58-
Installing NGINX
59-
{{</card >}}
57+
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" />}}
6058
{{</card-section >}}
6159
{{</card-layout >}}

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)