move dynamic-img example to rich content page

This commit is contained in:
Artis3n
2022-12-09 16:26:22 -05:00
parent c68ff46e73
commit 6da06e4755
3 changed files with 24 additions and 9 deletions
+1 -8
View File
@@ -1,12 +1,5 @@
<!--
Use as follows:
{{< dynamic-img src="/my/image/on/cloudinary.webp" title="A title for the image" >}}
Optionally, you can customize the width or other general styles for the image:
{{< dynamic-img src="/my/image/on/cloudinary.webp" title="A title for the image" width="w_auto" style="max-width:90%" >}}
-->
{{ $image := .Get "src" }}
{{ $alt := .Get "title" }}
{{ $width := .Get "width" | default "w_auto" }}
{{ $style := .Get "style" | default "max-width:80%" }}
<img alt="{{ $alt }}" title="{{ $alt }}" data-src="https://res.cloudinary.com/{{ $.Site.Params.cloudinary_cloud_name }}/{{ $width }},c_scale,f_auto,q_auto,dpr_auto{{ $image}}" class="cld-responsive" style="padding-bottom: 16px; {{ $style }}">
<img alt="{{ $alt }}" title="{{ $alt }}" data-src="https://res.cloudinary.com/{{ $.Site.Params.cloudinary_cloud_name }}/{{ $width }},c_scale,f_auto,q_auto,dpr_auto{{ $image}}" class="cld-responsive" style="padding-bottom: 16px; display: block; margin: auto; {{ $style }}">