shortcodes/paige/image.html: param "style" is missing
jotwg opened this issue · 8 comments
Can't pass parameter "style" to paige/img shortcode, I think image.html should look like this:
{{ $alt := .Get "alt" }}
{{ $link := .Get "link" }}
{{ $height := .Get "height" }}
{{ $maxheight := .Get "maxheight" }}
{{ $maxwidth := .Get "maxwidth" }}
{{ $method := .Get "method" }}
{{ $options := .Get "options" }}
{{ $style := .Get "style" }}
{{ $src := .Get 0 | default (.Get "src") }}
{{ $title := .Get "title" }}
{{ $width := .Get "width" }}
{{ if not $src }}
{{ errorf "paige/image: no content" }}
{{ end }}
{{ $content := partial "paige/img.html" (dict
"alt" $alt
"class" "img-fluid"
"height" $height
"maxheight" $maxheight
"maxwidth" $maxwidth
"method" $method
"options" $options
"style" $style
"page" .Page
"src" $src
"title" $title
"width" $width
) }}
{{ if $link }}
{{ $content = partial "paige/a.html" (dict
"content" $content
"href" $link
) }}
{{ end }}
<div class="paige-image">{{ $content }}</div>
cheers
Hi @jotwg, thanks for the suggestion. I’d like to understand your situation. What would you set style for?
see my reply email
What email? I only see these two messages:
Can't pass parameter "style" to paige/img shortcode [...]
see my reply email
However, your code looks way better (as far as I can judge, I'm a
total Hugo newbie), so I'm about to "steal" some pieces here and there,
that's why I'm looking at your shortcodes...
Thanks!
What is it you need to style here? Which CSS properties would you set?
in this case:
style="margin: 0px 5px 5px 0px; float: left; border:0;"
i.e. I want to let images float to the left or right (or even to the center, but that's more difficult) and define reasonable margins.
There's a paige/figure shortcode that can wrap a paige/image that provides floating, centering, and margins. For example, see https://willfaught.com/paige/shortcodes/figure/#float-parameter and https://willfaught.com/paige/shortcodes/image/#figure. Is that sufficient?
indeed!
(should read the docs more thoroughly, sorry...)