stereobooster 2023-09-11 13:16:41 +00:00 committed by GitHub
commit c251d75f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 18 deletions

View File

@ -9,6 +9,10 @@ This article offers a sample of basic Markdown formatting that can be used in Co
<!--more--> <!--more-->
## Image
![sample image](thumb-surendran-mp-IhWYiwSxm8g-unsplash.jpg)
## Headings ## Headings
The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest. The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.

View File

@ -23,27 +23,49 @@
{{ end }} {{ end }}
{{ with $resource }} {{ with $resource }}
<figure> <figure>
<img <picture>
class="mx-auto my-0 rounded-md" {{ if ne .MediaType.SubType "svg" }}
{{ if eq .MediaType.SubType "svg" }} <source
src="{{ .RelPermalink }}" {{ if lt .Width 660 }}
{{ else }} {{ with .Resize (printf "%dx%d webp" .Width .Height) }}
{{ if lt .Width 660 }} src="{{ .RelPermalink }}"
{{ end }}
{{ else }}
srcset="
{{- (.Resize "330x webp").RelPermalink }} 330w,
{{- (.Resize "660x webp").RelPermalink }} 660w,
{{- (.Resize "1024x webp").RelPermalink }} 1024w,
{{- (.Resize "1320x webp").RelPermalink }} 2x"
src="{{ (.Resize "660x webp").RelPermalink }}"
{{ end }}
type="image/webp"
/>
{{ end }}
<img
class="mx-auto my-0 rounded-md"
{{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
srcset=" width="{{ .Width }}"
{{- (.Resize "330x").RelPermalink }} 330w, height="{{ .Height }}"
{{- (.Resize "660x").RelPermalink }} 660w, decoding="async"
{{- (.Resize "1024x").RelPermalink }} 1024w, {{ if lt .Width 660 }}
{{- (.Resize "1320x").RelPermalink }} 2x" src="{{ .RelPermalink }}"
src="{{ (.Resize "660x").RelPermalink }}" {{ else }}
srcset="
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
{{ end }}
{{ end }} {{ end }}
{{ end }} alt="{{ $altText }}"
alt="{{ $altText }}" {{ if $lazyLoad }}
{{ if $lazyLoad }} loading="lazy"
loading="lazy" {{ end }}
{{ end }} />
/> </picture>
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }} {{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
</figure> </figure>
{{ else }} {{ else }}

View File

@ -20,6 +20,8 @@
{{ if eq .MediaType.SubType "svg" }} {{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}

View File

@ -22,6 +22,8 @@
{{- (.Fill "160x120 smart").RelPermalink }} {{- (.Fill "160x120 smart").RelPermalink }}
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x" 160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}" src="{{ (.Fill "160x120 smart").RelPermalink }}"
width="160"
height="120"
{{ end }} {{ end }}
{{ if $.Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"

View File

@ -27,6 +27,8 @@
{{ if eq .MediaType.SubType "svg" }} {{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}