Merge pull request #593 from androw/access2

️ Alt text management
This commit is contained in:
Nuno Coração 2023-03-12 19:44:55 +00:00 committed by GitHub
commit 282eb80cc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -3,14 +3,16 @@
{{- $images := .Resources.ByType "image" -}} {{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- $alt := .Page.Title -}}
{{- with .Page.Params.alt }}{{ $alt = . }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
{{ if $disableImageOptimization }} {{ if $disableImageOptimization }}
{{ with . }} {{ with . }}
<img class="w-full rounded-lg single_hero_round nozoom" src="{{ .RelPermalink }}"> <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}">
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ with .Resize "1200x" }}
<img class="w-full rounded-lg single_hero_round nozoom" src="{{ .RelPermalink }}"> <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}">
{{ end }} {{ end }}
{{ end }} {{ end }}
{{- end -}} {{- end -}}

View file

@ -8,7 +8,7 @@
{{ with .Site.Params.defaultBackgroundImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ with .Site.Params.defaultBackgroundImage }}{{ $homepageImage = resources.Get . }}{{ end }}
{{ with .Site.Params.homepage.homepageImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ with .Site.Params.homepage.homepageImage }}{{ $homepageImage = resources.Get . }}{{ end }}
{{ if not (eq $homepageImage "") }} {{ if not (eq $homepageImage "") }}
<img class="w-full h-[1000px] object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}"> <img class="w-full h-[1000px] object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}" role="presentation">
<div <div
class="absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> class="absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div> </div>