Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue figure attr #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Issue figure attr #18

wants to merge 4 commits into from

Conversation

it-gro
Copy link

@it-gro it-gro commented Jan 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant