Add alt attributes for content images
This commit is contained in:
parent
13fd2f8659
commit
e17520cfaa
2 changed files with 13 additions and 5 deletions
|
@ -1,10 +1,14 @@
|
|||
{{ define "img" }}
|
||||
<img src='{{ .Get "src" }}' class='{{ .Get "class" }}' alt="{{ .Inner | plainify }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if .Inner }}
|
||||
<figure>
|
||||
<img src='{{ .Get "src" }}' class='{{ .Get "class" }}' />
|
||||
{{ template "img" . }}
|
||||
<figcaption>
|
||||
<small>{{ .Inner }}</small>
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{ else }}
|
||||
<img src='{{ .Get "src" }}' class='{{ .Get "class" }}' />
|
||||
{{ template "img" . }}
|
||||
{{ end }}
|
||||
|
|
|
@ -13,15 +13,19 @@
|
|||
{{ .Scratch.Set "image" ($original.Fill $options) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $image := .Scratch.Get "image" }}
|
||||
|
||||
{{ define "img" }}
|
||||
{{ $image := .Scratch.Get "image" }}
|
||||
<img src='{{ $image.RelPermalink }}' class='{{ .Get "class" }}' alt="{{ .Inner | plainify }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if .Inner }}
|
||||
<figure>
|
||||
<img src="{{ $image.RelPermalink }}" class='{{ .Get "class" }}' />
|
||||
{{ template "img" . }}
|
||||
<figcaption>
|
||||
<small>{{ .Inner }}</small>
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{ else }}
|
||||
<img src="{{ $image.RelPermalink }}" class='{{ .Get "class" }}' />
|
||||
{{ template "img" . }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue