Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the img-grid shortcode #105

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" . }}