Skip to content

Commit

Permalink
feat: add nozoom attribute to figure
Browse files Browse the repository at this point in the history
  • Loading branch information
fuse314 authored Aug 28, 2023
1 parent 6e0164d commit ea2f848
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{{ $caption := .Get "caption" }}
{{ $href := .Get "href" }}
{{ $class := .Get "class" }}
{{ $nozoom := .Get "nozoom" | default false }}
{{ if findRE "^https?" $url.Scheme }}
<figure>
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
Expand All @@ -24,13 +25,13 @@
{{ with $href }}<a href="{{ . }}">{{ end }}
{{ if $disableImageOptimization }}
<img
class="my-0 rounded-md"
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
src="{{ .RelPermalink }}"
alt="{{ $altText }}"
/>
{{ else }}
<img
class="my-0 rounded-md"
class="my-0 rounded-md{{ if $nozoom }} nozoom{{ end }}"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
Expand All @@ -45,7 +46,7 @@
</figure>
{{ else }}
<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 }}
</figure>
{{ end }}
Expand Down

0 comments on commit ea2f848

Please sign in to comment.