mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-21 05:01:53 +02:00
Merge pull request #1287 from graeme-a-stewart/figure-target
Add target parameter to figure shortcode
This commit is contained in:
commit
abd2a8ed94
2 changed files with 3 additions and 1 deletions
|
@ -204,6 +204,7 @@ The `figure` shortcode accepts six parameters:
|
||||||
| `caption` | Markdown for the image caption, which will be displayed below the image. |
|
| `caption` | Markdown for the image caption, which will be displayed below the image. |
|
||||||
| `class` | Additional CSS classes to apply to the image. |
|
| `class` | Additional CSS classes to apply to the image. |
|
||||||
| `href` | URL that the image should be linked to. |
|
| `href` | URL that the image should be linked to. |
|
||||||
|
| `target` | The target attribute for the `href` URL. |
|
||||||
| `nozoom` | `nozoom=true` disables the image "zoom" functionality. This is most useful in combination with a `href` link. |
|
| `nozoom` | `nozoom=true` disables the image "zoom" functionality. This is most useful in combination with a `href` link. |
|
||||||
| `default` | Special parameter to revert to default Hugo `figure` behaviour. Simply provide `default=true` and then use normal [Hugo shortcode syntax](https://gohugo.io/content-management/shortcodes/#figure). |
|
| `default` | Special parameter to revert to default Hugo `figure` behaviour. Simply provide `default=true` and then use normal [Hugo shortcode syntax](https://gohugo.io/content-management/shortcodes/#figure). |
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
{{ $caption := .Get "caption" }}
|
{{ $caption := .Get "caption" }}
|
||||||
{{ $href := .Get "href" }}
|
{{ $href := .Get "href" }}
|
||||||
{{ $class := .Get "class" }}
|
{{ $class := .Get "class" }}
|
||||||
|
{{ $target := .Get "target" }}
|
||||||
{{ $nozoom := .Get "nozoom" | default false }}
|
{{ $nozoom := .Get "nozoom" | default false }}
|
||||||
{{ if findRE "^https?" $url.Scheme }}
|
{{ if findRE "^https?" $url.Scheme }}
|
||||||
<figure>
|
<figure>
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with $resource }}
|
{{ with $resource }}
|
||||||
<figure {{ with $class }}class="{{ . }}"{{ end }}>
|
<figure {{ with $class }}class="{{ . }}"{{ end }}>
|
||||||
{{ with $href }}<a href="{{ . }}">{{ end }}
|
{{ with $href }}<a href="{{ . }}" {{ with $target }}target="{{ . }}"{{ end }}>{{ end }}
|
||||||
{{ if $disableImageOptimization }}
|
{{ if $disableImageOptimization }}
|
||||||
<img
|
<img
|
||||||
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
|
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue