Add gallery functionality with responsive styles and Photoswipe integration
This commit is contained in:
parent
c27a2820d4
commit
4ac804edc3
5 changed files with 389 additions and 3 deletions
|
@ -8,12 +8,13 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
|
|||
{{- $.Page.Scratch.Add "figurecount" 1 -}}
|
||||
<!-- use either src or link-thumb for thumbnail image -->
|
||||
{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }}
|
||||
{{- $thumbResource := $.Page.Resources.Get $thumb }}
|
||||
<div class="box{{ with .Get "caption-position" }} fancy-figure caption-position-{{.}}{{end}}{{ with .Get "caption-effect" }} caption-effect-{{.}}{{end}}" {{ with .Get "width" }}style="max-width:{{.}}"{{end}}>
|
||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }} itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<div class="img"{{ if .Parent }} style="background-image: url('{{ $thumb | relURL }}');"{{ end }}{{ with .Get "size" }} data-size="{{.}}"{{ end }}>
|
||||
<img itemprop="thumbnail" src="{{ $thumb | relURL }}" {{ with .Get "alt" | default (.Get "caption") }}alt="{{.}}"{{ end }}/><!-- <img> hidden if in .gallery -->
|
||||
<div class="img"{{ if .Parent }} style="background-image: url('{{ if $thumbResource }}{{ $thumbResource.RelPermalink }}{{ else }}{{ $thumb | relURL }}{{ end }}');"{{ end }}{{ with .Get "size" }} data-size="{{.}}"{{ end }}>
|
||||
<img itemprop="thumbnail" src="{{ if $thumbResource }}{{ $thumbResource.RelPermalink }}{{ else }}{{ $thumb | relURL }}{{ end }}" {{ with .Get "alt" | default (.Get "caption") }}alt="{{.}}"{{ end }}/><!-- <img> hidden if in .gallery -->
|
||||
</div>
|
||||
{{ with .Get "link" | default (.Get "src") }}<a href="{{ . | relURL }}" itemprop="contentUrl"></a>{{ end }}
|
||||
{{ with .Get "link" | default (.Get "src") }}<a href="{{ if $thumbResource }}{{ $thumbResource.RelPermalink }}{{ else }}{{ . | relURL }}{{ end }}" itemprop="contentUrl"></a>{{ end }}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
||||
<figcaption>
|
||||
{{- with .Get "title" }}<h4>{{.}}</h4>{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue