demo: add gallery section
No files matched your search
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
@@ -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 >}}
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||