mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-02-02 03:22:33 -06:00
Merge pull request #944 from fuse314/feature/figure_nozoom
🖼️ figure with nozoom
This commit is contained in:
commit
31ba51515c
2 changed files with 5 additions and 3 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. |
|
||||||
|
| `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" }}
|
||||||
|
{{ $nozoom := .Get "nozoom" | default false }}
|
||||||
{{ if findRE "^https?" $url.Scheme }}
|
{{ if findRE "^https?" $url.Scheme }}
|
||||||
<figure>
|
<figure>
|
||||||
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||||
|
@ -24,13 +25,13 @@
|
||||||
{{ with $href }}<a href="{{ . }}">{{ end }}
|
{{ with $href }}<a href="{{ . }}">{{ end }}
|
||||||
{{ if $disableImageOptimization }}
|
{{ if $disableImageOptimization }}
|
||||||
<img
|
<img
|
||||||
class="my-0 rounded-md"
|
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
|
||||||
src="{{ .RelPermalink }}"
|
src="{{ .RelPermalink }}"
|
||||||
alt="{{ $altText }}"
|
alt="{{ $altText }}"
|
||||||
/>
|
/>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<img
|
<img
|
||||||
class="my-0 rounded-md"
|
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
|
||||||
srcset="
|
srcset="
|
||||||
{{ (.Resize "330x").RelPermalink }} 330w,
|
{{ (.Resize "330x").RelPermalink }} 330w,
|
||||||
{{ (.Resize "660x").RelPermalink }} 660w,
|
{{ (.Resize "660x").RelPermalink }} 660w,
|
||||||
|
@ -45,7 +46,7 @@
|
||||||
</figure>
|
</figure>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<figure>
|
<figure>
|
||||||
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
<img class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||||
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
||||||
</figure>
|
</figure>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue