demo: add gallery section

This commit is contained in:
George Cushen committed 2019-02-20 17:46:08 +00:00
1 parent 3ac394a58c
commit 3462cadba1
11 files changed
+23 -3

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+14
View File
@@ -0,0 +1,14 @@
+++
# Custom widget.
widget = "custom" # Do not modify this line!
active = true # Activate this widget? true/false
# Note: a full width section format can be enabled by commenting out the `title` and `subtitle` with a `#`.
title = "Gallery"
subtitle = ""
# Order that this section will appear in.
weight = 65
+++
{{< gallery >}}
+1 -1
View File
@@ -37,7 +37,7 @@
{{ if $item.cta_url }}
{{ $pack := or .icon_pack "fa" }}
<p>
<a href="{{ $item.cta_url }}" class="btn btn-outline-light btn-lg">
<a href="{{ $item.cta_url }}" class="btn btn-light btn-lg">
{{- with $item.cta_icon -}}<i class="{{ $pack }} {{ $pack }}-{{ . }}" style="padding-right: 10px;"></i>{{- end -}}
{{- $item.cta_label | emojify | safeHTML -}}
</a>
+8 -2
View File
@@ -1,9 +1,11 @@
{{ $album := "gallery" }}
{{ with .Get "album" }}{{ $album = . }}{{ end }}
{{ $album_path := printf "%s/*" $album }}
{{/* if eq .Page.Type "home" */}}{{/* $album_path = "*" */}}{{/* end */}}
<div class="gallery">
{{/* Attempt to automatically load gallery images from page bundle */}}
{{ $images := ($.Page.Resources.ByType "image").Match (printf "%s/*" $album) }}
{{ $images := ($.Page.Resources.ByType "image").Match $album_path }}
{{ with $images }}
{{ range $images }}
{{ $image := .Resize "x190" }}
@@ -23,6 +25,7 @@
{{else}}
{{/* Load gallery images from the `static/img/` media library or internet */}}
{{ if $.Page.Params.gallery_item }}
{{ range (where $.Page.Params.gallery_item "album" $album) }}
{{/* Set image path. */}}
{{ $.Scratch.Set "src" .image }}
@@ -34,6 +37,9 @@
<a data-fancybox="gallery{{ with .album }}-{{.}}{{ end }}" {{ with .caption }}data-caption="{{.}}"{{ end }} href="{{$.Scratch.Get "src"}}">
<img src="{{$.Scratch.Get "src"}}" alt="">
</a>
{{ end }}
{{end}}
{{else}}
{{ errorf "Unable to load gallery in %s." .Page.Filename }}
{{end}}
{{end}}
</div>