Add raw param to image shortcodes
This commit is contained in:
@@ -602,6 +602,7 @@ The `paige/image` shortcode provides a figure with a centered image.
|
||||
maxwidth="10rem"
|
||||
method="resize"
|
||||
options="550x webp picture Lanczos"
|
||||
raw=false
|
||||
src="me.jpg"
|
||||
title="My title"
|
||||
width="10rem" >}}
|
||||
@@ -630,6 +631,8 @@ Parameters:
|
||||
<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 <a href="https://gohugo.io/content-management/image-processing/#image-processing-methods">Image Processing Methods</a>.</dd>
|
||||
<dt><code>options</code></dt>
|
||||
<dd>Optional. String. Hugo image processing options. Must be specified with <code>method</code>. See <a href="https://gohugo.io/content-management/image-processing/#image-processing-options">Image Processing Options</a>.</dd>
|
||||
<dt><code>raw</code></dt>
|
||||
<dd>Optional. Boolean. Whether to reference an image without copying it. Default is false.</dd>
|
||||
<dt><code>src</code></dt>
|
||||
<dd>Required. Position 0. String. URL. Image URL.</dd>
|
||||
<dt><code>title</code></dt>
|
||||
@@ -661,10 +664,12 @@ The `paige/gallery` shortcode provides a figure with a centered list of images.
|
||||
{{< paige/gallery
|
||||
image="me.jpg"
|
||||
caption="My caption"
|
||||
raw=false
|
||||
>}}
|
||||
{{< paige/gallery
|
||||
image="you.jpg"
|
||||
caption="My caption"
|
||||
raw=false
|
||||
>}}
|
||||
{{< /paige/gallery >}}
|
||||
```
|
||||
@@ -694,6 +699,8 @@ Parameters:
|
||||
<dd>Optional. String. Hugo image processing method. Must be <code>crop</code>, <code>fill</code>, <code>fit</code>, or <code>resize</code>. Default is <code>resize</code>. Must be specified with <code>options</code>. See <a href="https://gohugo.io/content-management/image-processing/#image-processing-methods">Image Processing Methods</a>.</dd>
|
||||
<dt><code>options</code></dt>
|
||||
<dd>Optional. String. Hugo image processing options. Default is <code>550x webp picture Lanczos</code>. Must be specified with <code>method</code>. See <a href="https://gohugo.io/content-management/image-processing/#image-processing-options">Image Processing Options</a>.</dd>
|
||||
<dt><code>raw</code></dt>
|
||||
<dd>Optional. Boolean. Whether to reference an image without copying it. Default is false.</dd>
|
||||
<dt><code>type</code></dt>
|
||||
<dd>Optional. String. Type of layout. Must be <code>grid</code> or <code>list</code>. Default is <code>list</code>.</dd>
|
||||
<dt><code>width</code></dt>
|
||||
|
@@ -9,6 +9,22 @@ title: Gallery Shortcode
|
||||
See the images in the example site to understand how the below file patterns work.
|
||||
Resize the viewport as narrow and wide as you can to see the responsiveness.
|
||||
|
||||
Code:
|
||||
|
||||
```go-text-template
|
||||
{{</* paige/gallery */>}}
|
||||
{{</* paige/gallery image="https://picsum.photos/400/300.webp" raw=true /*/>}}
|
||||
{{</* /paige/gallery */>}}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
{{< paige/gallery >}}
|
||||
{{< paige/gallery image="https://picsum.photos/400/300.webp" raw=true />}}
|
||||
{{< /paige/gallery >}}
|
||||
|
||||
---
|
||||
|
||||
## Rows layout
|
||||
|
||||
Code:
|
||||
|
@@ -9,6 +9,7 @@
|
||||
{{ $method := .method }}
|
||||
{{ $options := .options }}
|
||||
{{ $page := .page }}
|
||||
{{ $raw := .raw }}
|
||||
{{ $resource := .resource }}
|
||||
{{ $src := .src }}
|
||||
{{ $table := .table }}
|
||||
@@ -21,6 +22,7 @@
|
||||
"method" $method
|
||||
"options" $options
|
||||
"page" $page
|
||||
"raw" $raw
|
||||
"resource" $resource
|
||||
"src" $src
|
||||
"title" $title
|
||||
|
@@ -8,25 +8,33 @@
|
||||
{{ $maxwidth := .Get "maxwidth" }}
|
||||
{{ $method := .Get "method" | default "resize" }}
|
||||
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
|
||||
{{ $raw := .Get "raw" }}
|
||||
{{ $type := .Get "type" | default "rows" }}
|
||||
{{ $width := .Get "width" }}
|
||||
|
||||
{{ if $image }}
|
||||
{{ $resource := partial "paige/func-resource.html" (dict
|
||||
"page" .Page
|
||||
"url" $image
|
||||
) }}
|
||||
{{ $link := $image }}
|
||||
{{ $resource := "" }}
|
||||
|
||||
{{ if not $raw }}
|
||||
{{ $resource = partial "paige/func-resource.html" (dict
|
||||
"page" .Page
|
||||
"url" $image
|
||||
) }}
|
||||
{{ $link = $resource.RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "paige/image-figure.html" (dict
|
||||
"caption" $caption
|
||||
"compact" true
|
||||
"height" $height
|
||||
"link" $resource.RelPermalink
|
||||
"link" $link
|
||||
"maxheight" $maxheight
|
||||
"maxwidth" $maxwidth
|
||||
"method" $method
|
||||
"options" $options
|
||||
"page" .Page
|
||||
"raw" $raw
|
||||
"resource" $resource
|
||||
"src" $image
|
||||
"table" true
|
||||
|
@@ -8,6 +8,7 @@
|
||||
{{ $maxwidth := .Get "maxwidth" }}
|
||||
{{ $method := .Get "method" }}
|
||||
{{ $options := .Get "options" }}
|
||||
{{ $raw := .Get "raw" }}
|
||||
{{ $src := .Get 0 | default (.Get "src") }}
|
||||
{{ $title := .Get "title" }}
|
||||
{{ $width := .Get "width" }}
|
||||
@@ -23,6 +24,7 @@
|
||||
"maxwidth" $maxwidth
|
||||
"method" $method
|
||||
"options" $options
|
||||
"raw" $raw
|
||||
"src" $src
|
||||
"title" $title
|
||||
"width" $width
|
||||
|
Reference in New Issue
Block a user