hugo-easy-gallery
hugo-easy-gallery copied to clipboard
Issue figure attr
Hi Yip
Here's another one (now using a branch).
There's an issue with the figure attributes attr and attrlink.
{{< figure thumb="-thumb" link="/img/hugo-dolor.png" size="900x450" caption="foo" attr="(c) by bar" attrlink="https://www.example.com" >}}
leads to an error:
ERROR 2018/01/10 15:07:44 error processing shortcode "shortcodes/figure.html" for page "post/test-heg-figure-attrlink.md": template: shortcodes/figure.html:23:57: executing "shortcodes/figure.html" at <.Get>: can't evaluate field Get in type string
I fixed that and improved the captions. If a figure has an attribution it needs to be shown:
https://stackoverflow.com/questions/21483356/how-to-mark-the-copyright-of-an-image-in-html
So I did: figure.html:
{{- if or (.Get "attr") (.Get "attrlink") }}
<footer><small>{{if .Get "attrlink"}}<a href="{{.Get `attrlink`}}">{{ default (.Get "attrlink") (.Get "attr") }}</a>{{ else }}{{ .Get "attr"}}{{ end }}</small></footer>
load-photoswipe.js:
title : ($title ? $title : "") + ($title_footer ? ($title ? "<br/><small>" : "") + $title_footer + ($title ? "</small>" : "" ) : "")
load-photoswipe.html, load-photoswipe-theme.html, hugo-easy-gallery.css:
Adjust color for a tag
(Kind of ugly in the html files, maybe you see a better way)
hugo-easy-gallery.css I did ad well:
figure img {
max-width: 100%;
}
You have this in https://www.liwen.id.au/css/main.css as well. Without it, the thumbs are cropped. It took me a while until I figured that on out.
Test site: https://github.com/it-gro/HugoTestingHegAttrIssue
Kind regards