Skip to content

Commit

Permalink
feat: add the img-grid shortcode (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Jan 13, 2024
1 parent 0bbc682 commit b45a888
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions layouts/partials/bootstrap/img-grid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- $key := "" }}
{{- if .IsNamedParams }}
{{- $key = .Get "data" }}
{{- else }}
{{- $key = .Get 0 }}
{{- end }}
{{- $data := partialCached "bootstrap/functions/data" (dict "key" $key "page" .Page) .Page $key }}
{{- with $data }}
<div class="d-flex bs-img-grid flex-wrap gap-1 justify-content-center">
{{- range . }}
{{- $img := partial "images/image" (dict
"Filename" .src
"ClassName" "bs-img-grid-item-img"
"Alt" .title
"Caption" .title)
}}
{{- if .url }}
<a class="bs-img-grid-item text-center" href="{{ .url }}" target="_blank">
{{ $img }}
</a>
{{- else }}
<div class="bs-img-grid-item text-center">
{{ $img }}
</div>
{{- end }}
{{- end }}
</div>
{{- end }}
1 change: 1 addition & 0 deletions layouts/shortcodes/bootstrap/img-grid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ partial "bootstrap/img-grid" . }}
1 change: 1 addition & 0 deletions layouts/shortcodes/bs/img-grid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ partial "bootstrap/img-grid" . }}

0 comments on commit b45a888

Please sign in to comment.