Skip to content

Commit

Permalink
refactor: restore light gallary
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed May 23, 2024
1 parent 7ffe97b commit b0de0e9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions layouts/partials/plugin/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
- Resources: If the image is a page resource, this parameter is required. It is the .Resources of the page.
- Optim: optimisation parameter, defined like
{{- $optim := slice
(dict "Process" "fill 800x240 Center webp q75" "descriptor" "800w")
(dict "Process" "fill 1200x360 Center webp q75" "descriptor" "1200w")
(dict "Process" "fill 1600x480 Center webp q75" "descriptor" "1600w")
(dict "Process" "resize 800x Center webp q75" "descriptor" "800w")
(dict "Process" "resize 1200x Center webp q75" "descriptor" "1200w")
(dict "Process" "resize 1600x Center webp q75" "descriptor" "1600w")
-}}
See https://gohugo.io/content-management/image-processing/ for more information.
*/}}
Expand Down Expand Up @@ -47,11 +47,17 @@
{{- end -}}

{{- $src := $resource.RelPermalink | default .Src -}}
{{- $alt := .Alt | default .Title | default "alt text" -}}
{{- $alt := .Alt | default .Title -}}
{{- $height := .Height | default $resource.Height | default "" -}}
{{- $width := .Width | default $resource.Width | default "" -}}

{{- if .Linked -}}
<a class="lightgallery" href="{{ $src }}" title="{{ .Title | default .Alt }}" data-thumbnail="{{ $src }}"{{ with .Caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img {{ with .Class }}class="{{ . }}"{{ end }} {{ with .Loading }}loading="{{ . }}"{{ end }} src="{{ $src }}" {{ with $srcset }}srcset="{{ . }}"{{ end }} {{ with .Sizes }}sizes="{{ . }}"{{ end }} {{ with $alt }}alt=""{{ end }} {{ with $height }}height="{{ . }}"{{ end }} {{ with $width }}width="{{ . }}"{{ end }}>
{{- if .Linked -}}
</a>
{{- end -}}


{{/*
Expand Down

0 comments on commit b0de0e9

Please sign in to comment.