Add maxheight, maxwidth params to image
This commit is contained in:
@@ -438,6 +438,8 @@ The `paige/image` shortcode provides a figure with an image.
|
||||
alt="My alt" >}}
|
||||
height="10rem"
|
||||
link="https://github.com/willfaught/paige"
|
||||
maxheight="10rem"
|
||||
maxwidth="10rem"
|
||||
method="resize"
|
||||
options="550x webp picture Lanczos"
|
||||
raw=false
|
||||
@@ -458,6 +460,10 @@ Parameters:
|
||||
<dd>Optional. String. CSS value. Image height.</dd>
|
||||
<dt><code>link</code></dt>
|
||||
<dd>Optional. String. URL. Image link.</dd>
|
||||
<dt><code>maxheight</code></dt>
|
||||
<dd>Optional. String. CSS value. Image maximum height.</dd>
|
||||
<dt><code>maxwidth</code></dt>
|
||||
<dd>Optional. String. CSS value. Image maximum width.</dd>
|
||||
<dt><code>method</code></dt>
|
||||
<dd>Optional. String. Hugo image processing method. Must be <code>crop</code>, <code>fill</code>, <code>fit</code>, or <code>resize</code>. Must be specified with <code>options</code>. See the <a href="https://gohugo.io/content-management/image-processing/#image-processing-methods">methods</a>.</dd>
|
||||
<dt><code>options</code></dt>
|
||||
|
@@ -47,6 +47,30 @@ Result:
|
||||
|
||||
{{< paige/image link="https://github.com/willfaught/paige" src="landscape.webp" >}}
|
||||
|
||||
## Maxheight parameter
|
||||
|
||||
Code:
|
||||
|
||||
```go-text-template
|
||||
{{</* paige/image maxheight="10rem" src="landscape.webp" */>}}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
{{< paige/image maxheight="10rem" src="landscape.webp" >}}
|
||||
|
||||
## Maxwidth parameter
|
||||
|
||||
Code:
|
||||
|
||||
```go-text-template
|
||||
{{</* paige/image maxwidth="10rem" src="landscape.webp" */>}}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
{{< paige/image maxwidth="10rem" src="landscape.webp" >}}
|
||||
|
||||
## Method and options parameters
|
||||
|
||||
Code:
|
||||
|
@@ -1,6 +1,8 @@
|
||||
{{ $alt := .Get "alt" }}
|
||||
{{ $link := .Get "link" }}
|
||||
{{ $height := .Get "height" }}
|
||||
{{ $maxheight := .Get "maxheight" }}
|
||||
{{ $maxwidth := .Get "maxwidth" }}
|
||||
{{ $method := .Get "method" }}
|
||||
{{ $options := .Get "options" }}
|
||||
{{ $raw := .Get "raw" }}
|
||||
@@ -12,6 +14,8 @@
|
||||
"alt" $alt
|
||||
"class" "img-fluid"
|
||||
"height" $height
|
||||
"maxheight" $maxheight
|
||||
"maxwidth" $maxwidth
|
||||
"method" $method
|
||||
"options" $options
|
||||
"page" .Page
|
||||
|
Reference in New Issue
Block a user