Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Nov 26, 2023
1 parent 0c6c30f commit c8b33ae
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<figure>
{{- with $img -}}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
{{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
{{- else -}}
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/>
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
<div class="prose">
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }}
{{ $class := "mb-6 -mt-4 rounded-md" }}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }}
{{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }}
{{ with $.Params.coverCaption }}
<figcaption class="mb-6 -mt-3 text-center">{{ . | markdownify }}</figcaption>
{{ end }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/picture.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ $img := .img }}
{{ $alt := .alt }}
{{ $class := .class }}
{{ $lazy := .lazy }}
{{ $webp := .webp }}
{{ $lqip := .lqip }}
{{ $x2 := .x2 }}
{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := .webp | default $.Page.Site.Params.enableImageWebp | default true }}
{{ $lqip := .lqip | default false }}
{{ $x2 := .x2 | default false }}

{{ with $img }}
{{ if (eq .MediaType.SubType "svg") }}
Expand Down
8 changes: 0 additions & 8 deletions layouts/partials/pictureDefaults.html

This file was deleted.

2 changes: 1 addition & 1 deletion layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ with $href }}<a href="{{ . }}">{{ end }}

{{- with $img -}}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }}
{{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }}
{{- else -}}
<img src="{{ $url.String }}" alt="{{ $altText }}" class="{{ $class }}"/>
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/screenshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{ $altText = (.Get "caption") | markdownify | plainify }}
{{ end }}

{{ partial "pictureDefaults.html" (dict "img" $image "alt" $altText "x2" true) }}
{{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true) }}

{{- if .Get "href" }}</a>{{ end -}}
{{- if .Get "caption" -}}
Expand Down

0 comments on commit c8b33ae

Please sign in to comment.