New shortcode, uses JS (sadly) but at least it doesn't break the

RSS feed
This commit is contained in:
Luca Beltrame 2021-01-07 23:52:44 +01:00
parent 424c2b73ff
commit a67da2b6ff
Signed by: einar
GPG key ID: 4707F46E9EC72DEC
2 changed files with 9 additions and 26 deletions

View file

@ -70,4 +70,11 @@
</aside>
</article>
<script src="{{ "js/baguetteBox.min.js" | relURL}}" rel="application/javascript"></script>
<script>baguetteBox.run('figure', {
captions: function(element) {
return element.getElementsByTagName('img')[0].title;
}
});</script>
{{ end }}

View file

@ -5,37 +5,13 @@
{{ $imagethumbnail := $image.Resize $options }}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
<a href="#{{ $image.RelPermalink | md5 }}-img">
<img src="{{ $imagethumbnail.RelPermalink }}"
<a href="{{ $image.RelPermalink }}">
<img class="thumbnail" src="{{ $imagethumbnail.RelPermalink }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
/>
</a>
<figure id="{{ $image.RelPermalink | md5 }}-img" class="lbox fade">
<img src="{{ $image.RelPermalink }}" {{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
/>
<a href="#_"></a>
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption>
{{ with (.Get "title") -}}
<h5>{{ . }}</h5>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p class="f5 center">
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption class="center">
{{ with (.Get "title") -}}