Fix space in alt and style tags

This commit is contained in:
2021-11-10 20:17:42 +01:00
parent ea4c2dc200
commit fba2bd8805
8 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
{{- $img := resources.Get .path }}
{{- $img = $img.Resize (printf "%dx%d webp" $img.Width $img.Height) }}
<img src="{{ $img.Permalink }}" alt="{{ .alt | default " " }}" width="{{ .width | default $img.Width }}"
<img src="{{ $img.Permalink }}" alt="{{ .alt | default "" }}" width="{{ .width | default $img.Width }}"
height="{{ .height | default $img.Height }}" {{- if .class}}class="{{ .class }}" {{end}}
{{- if .style}}style="{{ .style | safeCSS | default " " }}" {{end}} />
{{- if .style}}style="{{ .style | safeCSS }}" {{end}} />
@@ -53,7 +53,7 @@
{{- $img := resources.Get .Params.cover }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
<meta name="twitter:image" content="{{ $img.Permalink }}" />
<meta name="twitter:image:alt" content="{{ .Params.title | plainify | default " " }}" />
<meta name="twitter:image:alt" content="{{ .Params.title | plainify }}" />
{{- end }}
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:description"
+1 -1
View File
@@ -75,7 +75,7 @@
</div>
{{- if .Params.Cover }}
<figure class="portfolio-cover">
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify | default " ")) }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify)) }}
{{- if .Params.CoverCaption }}
<figcaption class="center">{{ .Params.CoverCaption | markdownify }}</figcaption>
@@ -35,7 +35,7 @@
{{- end }}
{{- if .Params.Cover }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify | default " ") "class" "portfolio-cover") }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify) "class" "portfolio-cover") }}
{{- end }}
<div class="portfolio-content">
+1 -1
View File
@@ -38,7 +38,7 @@
{{- end }}
{{- if .Params.Cover }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify | default " ") "class" "post-cover") }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify) "class" "post-cover") }}
{{- end }}
<div class="post-content">
@@ -9,7 +9,7 @@
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" {{- end -}}
width="{{ .Get "width" | default $img.Width }}" height="{{ .Get "height" | default $img.Height }}" />
{{- else }}
{{- partial "image.html" (dict "path" (.Get "src") "alt" (or (.Get "alt") (.Get "caption" | markdownify | plainify) | default " ") "width" (.Get "width") "height" (.Get "height")) }}
{{- partial "image.html" (dict "path" (.Get "src") "alt" (or (.Get "alt") (.Get "caption" | markdownify | plainify)) "width" (.Get "width") "height" (.Get "height")) }}
{{- end }}
{{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
@@ -1,3 +1,3 @@
{{- if .Get "src" }}
{{- partial "image.html" (dict "path" (.Get "src") "alt" (.Get "alt" | plainify | default " ") "style" (.Get "style" | safeCSS | default " ") )}}
{{- partial "image.html" (dict "path" (.Get "src") "alt" (.Get "alt" | plainify) "style" (.Get "style" | safeCSS) )}}
{{- end }}
@@ -38,7 +38,7 @@
{{- end }}
{{- if .Params.Cover }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify | default " ") "class" "post-cover") }}
{{- partial "image.html" (dict "path" .Params.Cover "alt" (.Title | plainify) "class" "post-cover") }}
{{- end }}
<div class="post-content">