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

shortcodes/paige/image.html: param "style" is missing #14

Closed
jotwg opened this issue Mar 25, 2023 · 8 comments
Closed

shortcodes/paige/image.html: param "style" is missing #14

jotwg opened this issue Mar 25, 2023 · 8 comments

Comments

@jotwg
Copy link

jotwg commented Mar 25, 2023

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

@willfaught
Copy link
Owner

Hi @jotwg, thanks for the suggestion. I’d like to understand your situation. What would you set style for?

@jotwg
Copy link
Author

jotwg commented Mar 25, 2023

see my reply email

@willfaught
Copy link
Owner

What email? I only see these two messages:

Can't pass parameter "style" to paige/img shortcode [...]

see my reply email

@jotwg
Copy link
Author

jotwg commented Mar 25, 2023 via email

@willfaught
Copy link
Owner

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!

https://cloudi.myfirewall.org/camino2007/vorbereitungen/

What is it you need to style here? Which CSS properties would you set?

@jotwg
Copy link
Author

jotwg commented Mar 25, 2023

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.

@willfaught
Copy link
Owner

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?

@jotwg
Copy link
Author

jotwg commented Mar 25, 2023

indeed!

(should read the docs more thoroughly, sorry...)

@jotwg jotwg closed this as completed Mar 25, 2023
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

No branches or pull requests

2 participants