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"
|
maxwidth="10rem"
|
||||||
method="resize"
|
method="resize"
|
||||||
options="550x webp picture Lanczos"
|
options="550x webp picture Lanczos"
|
||||||
|
raw=false
|
||||||
src="me.jpg"
|
src="me.jpg"
|
||||||
title="My title"
|
title="My title"
|
||||||
width="10rem" >}}
|
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>
|
<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>
|
<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>
|
<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>
|
<dt><code>src</code></dt>
|
||||||
<dd>Required. Position 0. String. URL. Image URL.</dd>
|
<dd>Required. Position 0. String. URL. Image URL.</dd>
|
||||||
<dt><code>title</code></dt>
|
<dt><code>title</code></dt>
|
||||||
@@ -661,10 +664,12 @@ The `paige/gallery` shortcode provides a figure with a centered list of images.
|
|||||||
{{< paige/gallery
|
{{< paige/gallery
|
||||||
image="me.jpg"
|
image="me.jpg"
|
||||||
caption="My caption"
|
caption="My caption"
|
||||||
|
raw=false
|
||||||
>}}
|
>}}
|
||||||
{{< paige/gallery
|
{{< paige/gallery
|
||||||
image="you.jpg"
|
image="you.jpg"
|
||||||
caption="My caption"
|
caption="My caption"
|
||||||
|
raw=false
|
||||||
>}}
|
>}}
|
||||||
{{< /paige/gallery >}}
|
{{< /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>
|
<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>
|
<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>
|
<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>
|
<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>
|
<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>
|
<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.
|
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.
|
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
|
## Rows layout
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
{{ $method := .method }}
|
{{ $method := .method }}
|
||||||
{{ $options := .options }}
|
{{ $options := .options }}
|
||||||
{{ $page := .page }}
|
{{ $page := .page }}
|
||||||
|
{{ $raw := .raw }}
|
||||||
{{ $resource := .resource }}
|
{{ $resource := .resource }}
|
||||||
{{ $src := .src }}
|
{{ $src := .src }}
|
||||||
{{ $table := .table }}
|
{{ $table := .table }}
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
"method" $method
|
"method" $method
|
||||||
"options" $options
|
"options" $options
|
||||||
"page" $page
|
"page" $page
|
||||||
|
"raw" $raw
|
||||||
"resource" $resource
|
"resource" $resource
|
||||||
"src" $src
|
"src" $src
|
||||||
"title" $title
|
"title" $title
|
||||||
|
@@ -8,25 +8,33 @@
|
|||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
{{ $method := .Get "method" | default "resize" }}
|
{{ $method := .Get "method" | default "resize" }}
|
||||||
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
|
{{ $options := .Get "options" | default "550x webp picture Lanczos" }}
|
||||||
|
{{ $raw := .Get "raw" }}
|
||||||
{{ $type := .Get "type" | default "rows" }}
|
{{ $type := .Get "type" | default "rows" }}
|
||||||
{{ $width := .Get "width" }}
|
{{ $width := .Get "width" }}
|
||||||
|
|
||||||
{{ if $image }}
|
{{ if $image }}
|
||||||
{{ $resource := partial "paige/func-resource.html" (dict
|
{{ $link := $image }}
|
||||||
|
{{ $resource := "" }}
|
||||||
|
|
||||||
|
{{ if not $raw }}
|
||||||
|
{{ $resource = partial "paige/func-resource.html" (dict
|
||||||
"page" .Page
|
"page" .Page
|
||||||
"url" $image
|
"url" $image
|
||||||
) }}
|
) }}
|
||||||
|
{{ $link = $resource.RelPermalink }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ partial "paige/image-figure.html" (dict
|
{{ partial "paige/image-figure.html" (dict
|
||||||
"caption" $caption
|
"caption" $caption
|
||||||
"compact" true
|
"compact" true
|
||||||
"height" $height
|
"height" $height
|
||||||
"link" $resource.RelPermalink
|
"link" $link
|
||||||
"maxheight" $maxheight
|
"maxheight" $maxheight
|
||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
"method" $method
|
"method" $method
|
||||||
"options" $options
|
"options" $options
|
||||||
"page" .Page
|
"page" .Page
|
||||||
|
"raw" $raw
|
||||||
"resource" $resource
|
"resource" $resource
|
||||||
"src" $image
|
"src" $image
|
||||||
"table" true
|
"table" true
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
{{ $maxwidth := .Get "maxwidth" }}
|
{{ $maxwidth := .Get "maxwidth" }}
|
||||||
{{ $method := .Get "method" }}
|
{{ $method := .Get "method" }}
|
||||||
{{ $options := .Get "options" }}
|
{{ $options := .Get "options" }}
|
||||||
|
{{ $raw := .Get "raw" }}
|
||||||
{{ $src := .Get 0 | default (.Get "src") }}
|
{{ $src := .Get 0 | default (.Get "src") }}
|
||||||
{{ $title := .Get "title" }}
|
{{ $title := .Get "title" }}
|
||||||
{{ $width := .Get "width" }}
|
{{ $width := .Get "width" }}
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
"maxwidth" $maxwidth
|
"maxwidth" $maxwidth
|
||||||
"method" $method
|
"method" $method
|
||||||
"options" $options
|
"options" $options
|
||||||
|
"raw" $raw
|
||||||
"src" $src
|
"src" $src
|
||||||
"title" $title
|
"title" $title
|
||||||
"width" $width
|
"width" $width
|
||||||
|
Reference in New Issue
Block a user