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" >}}
|
alt="My alt" >}}
|
||||||
height="10rem"
|
height="10rem"
|
||||||
link="https://github.com/willfaught/paige"
|
link="https://github.com/willfaught/paige"
|
||||||
|
maxheight="10rem"
|
||||||
|
maxwidth="10rem"
|
||||||
method="resize"
|
method="resize"
|
||||||
options="550x webp picture Lanczos"
|
options="550x webp picture Lanczos"
|
||||||
raw=false
|
raw=false
|
||||||
@@ -458,6 +460,10 @@ Parameters:
|
|||||||
<dd>Optional. String. CSS value. Image height.</dd>
|
<dd>Optional. String. CSS value. Image height.</dd>
|
||||||
<dt><code>link</code></dt>
|
<dt><code>link</code></dt>
|
||||||
<dd>Optional. String. URL. Image link.</dd>
|
<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>
|
<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>
|
<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>
|
<dt><code>options</code></dt>
|
||||||
|
@@ -47,6 +47,30 @@ Result:
|
|||||||
|
|
||||||
{{< paige/image link="https://github.com/willfaught/paige" src="landscape.webp" >}}
|
{{< 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
|
## Method and options parameters
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
{{ $alt := .Get "alt" }}
|
{{ $alt := .Get "alt" }}
|
||||||
{{ $link := .Get "link" }}
|
{{ $link := .Get "link" }}
|
||||||
{{ $height := .Get "height" }}
|
{{ $height := .Get "height" }}
|
||||||
|
{{ $maxheight := .Get "maxheight" }}
|
||||||
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
{{ $method := .Get "method" }}
|
{{ $method := .Get "method" }}
|
||||||
{{ $options := .Get "options" }}
|
{{ $options := .Get "options" }}
|
||||||
{{ $raw := .Get "raw" }}
|
{{ $raw := .Get "raw" }}
|
||||||
@@ -12,6 +14,8 @@
|
|||||||
"alt" $alt
|
"alt" $alt
|
||||||
"class" "img-fluid"
|
"class" "img-fluid"
|
||||||
"height" $height
|
"height" $height
|
||||||
|
"maxheight" $maxheight
|
||||||
|
"maxwidth" $maxwidth
|
||||||
"method" $method
|
"method" $method
|
||||||
"options" $options
|
"options" $options
|
||||||
"page" .Page
|
"page" .Page
|
||||||
|
Reference in New Issue
Block a user