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 }}
|
{{ if .Inner }}
|
||||||
<figure>
|
<figure>
|
||||||
<img src='{{ .Get "src" }}' class='{{ .Get "class" }}' />
|
{{ template "img" . }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<small>{{ .Inner }}</small>
|
<small>{{ .Inner }}</small>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<img src='{{ .Get "src" }}' class='{{ .Get "class" }}' />
|
{{ template "img" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -13,15 +13,19 @@
|
||||||
{{ .Scratch.Set "image" ($original.Fill $options) }}
|
{{ .Scratch.Set "image" ($original.Fill $options) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $image := .Scratch.Get "image" }}
|
|
||||||
|
{{ define "img" }}
|
||||||
|
{{ $image := .Scratch.Get "image" }}
|
||||||
|
<img src='{{ $image.RelPermalink }}' class='{{ .Get "class" }}' alt="{{ .Inner | plainify }}" />
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Inner }}
|
{{ if .Inner }}
|
||||||
<figure>
|
<figure>
|
||||||
<img src="{{ $image.RelPermalink }}" class='{{ .Get "class" }}' />
|
{{ template "img" . }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<small>{{ .Inner }}</small>
|
<small>{{ .Inner }}</small>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<img src="{{ $image.RelPermalink }}" class='{{ .Get "class" }}' />
|
{{ template "img" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue