feat: add alt message for archive & related contents images (#411)

This commit is contained in:
zhixuan 2021-12-05 05:05:53 +09:00 committed by GitHub
parent 72a5e956ee
commit 497643b363
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -22,6 +22,9 @@ _testmain.go
*.exe *.exe
*.test *.test
/public public
/themes themes
resources
assets/jsconfig.json
.DS_Store .DS_Store

View file

@ -29,6 +29,7 @@
<img src="{{ $Permalink }}" <img src="{{ $Permalink }}"
width="{{ $Width }}" width="{{ $Width }}"
height="{{ $Height }}" height="{{ $Height }}"
alt="{{ .Title }}"
loading="lazy"> loading="lazy">
{{ else }} {{ else }}
<img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" /> <img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />

View file

@ -21,7 +21,8 @@
width="{{ $Width }}" width="{{ $Width }}"
height="{{ $Height }}" height="{{ $Height }}"
loading="lazy" loading="lazy"
data-key="{{ .context.Slug }}" alt="Featured image of post {{ .context.Title }}"
{{ with .context.Slug }}data-key="{{ . }}" {{ end }}
data-hash="{{ $imageRaw.Data.Integrity }}"> data-hash="{{ $imageRaw.Data.Integrity }}">
{{ else }} {{ else }}
<img src="{{ $image.permalink }}" loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $image.permalink }}"/> <img src="{{ $image.permalink }}" loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $image.permalink }}"/>