Skip to content

Commit fc4fc35

Browse files
Add file option to grid shortcode (#511)
1 parent f319b9a commit fc4fc35

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

assets/theme-css/bulma.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ input,
1111
select {
1212
margin: 0;
1313
}
14-
video {
15-
height: auto;
16-
max-width: 100%;
17-
}
1814
iframe {
1915
border: 0;
2016
}

assets/theme-css/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ figure,
4141
display: block;
4242
margin-left: auto;
4343
margin-right: auto;
44+
max-width: 100%;
4445
text-align: center;
4546
}
4647

layouts/shortcodes/grid1.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
*/}}
6969

7070
<div class="sd-container-fluid sd-mb-4">
71+
{{ $cards := "" }}
7172
{{- with .Get "columns" -}}
7273
{{ $columns := split . " " }}
7374
{{ $xs := index $columns 0 }}
@@ -78,8 +79,16 @@
7879
{{- else }}
7980
<div class="sd-row sd-row-cols-auto sd-row-cols-xs-auto sd-row-cols-sm-auto sd-row-cols-md-auto sd-row-cols-lg-auto">
8081
{{- end }}
81-
{{ $cards := (index (.Inner | transform.Unmarshal) "card") }}
82-
{{- range $key, $d := $cards -}}
82+
{{- with .Get "file" -}}
83+
{{ with $.Page.Resources.Get . | transform.Unmarshal }}
84+
{{ $cards = (index . "card") }}
85+
{{ else }}
86+
{{ errorf "Unable to get page resource %q" . }}
87+
{{ end }}
88+
{{- else }}
89+
{{ $cards = (index (.Inner | transform.Unmarshal) "card") }}
90+
{{- end }}
91+
{{- range $key, $d := $cards -}}
8392
<div class="sd-col sd-d-flex-row">
8493
{{- with $d.link }}
8594
<div class="sd-card sd-w-100 sd-shadow-sm sd-card-hover">

0 commit comments

Comments
 (0)