use image alt wherever possible
This commit is contained in:
parent
bcff415581
commit
3706ace5e8
|
@ -19,7 +19,8 @@
|
||||||
"summary" (or .Params.description .Summary)
|
"summary" (or .Params.description .Summary)
|
||||||
"text" (lower .Plain)
|
"text" (lower .Plain)
|
||||||
"link" .Permalink
|
"link" .Permalink
|
||||||
"image" $image) }}
|
"image" $image
|
||||||
|
"imageAlt" (or .Params.Alt "")) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
"pages": {{ $mscratch.Get "articles" | jsonify }}
|
"pages": {{ $mscratch.Get "articles" | jsonify }}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
"tags" (sort (or .Params.tags slice))
|
"tags" (sort (or .Params.tags slice))
|
||||||
"summary" (or .Params.description .Summary)
|
"summary" (or .Params.description .Summary)
|
||||||
"link" .Permalink
|
"link" .Permalink
|
||||||
"image" $image) }}
|
"image" $image
|
||||||
|
"imageAlt" (or .Params.Alt "")) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
"articles": {{ $mscratch.Get "articles" | jsonify }},
|
"articles": {{ $mscratch.Get "articles" | jsonify }},
|
||||||
"test": "{{range $postsList}}{{.Title}} {{end}}",
|
"test": "{{range $postsList}}{{.Title}} {{end}}",
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
{{ if .Params.Image }}
|
{{ if .Params.Image }}
|
||||||
<a class="unstyledLink" href="{{ .Permalink }}">
|
<a class="unstyledLink" href="{{ .Permalink }}">
|
||||||
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
|
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
|
||||||
<img src="{{ .Params.Image }}" />
|
<img src="{{ .Params.Image }}" alt="{{ .Params.Alt }}" />
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<img src="/{{ path.Join .File.Dir .Params.Image }}" />
|
<img src="/{{ path.Join .File.Dir .Params.Image }}" alt="{{ .Params.Alt }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
function renderImage(image, link) {
|
function renderImage(image, link, alt) {
|
||||||
if (!image) return '';
|
if (!image) return '';
|
||||||
return `<a href="${link}"><img src="${image}" /></a>`;
|
return `<a href="${link}"><img src="${image}" alt="${alt}" /></a>`;
|
||||||
}
|
}
|
||||||
function renderSingleArticle(article) {
|
function renderSingleArticle(article) {
|
||||||
return `
|
return `
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</p>
|
</p>
|
||||||
{{ if .Site.Params.imageInArticlePreview }}
|
{{ if .Site.Params.imageInArticlePreview }}
|
||||||
${renderImage(article.image, article.link)}
|
${renderImage(article.image, article.link, article.imageAlt)}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if (site.Params.articleSummary | default true) }}
|
{{ if (site.Params.articleSummary | default true) }}
|
||||||
<div class="articlePreview">
|
<div class="articlePreview">
|
||||||
|
|
Loading…
Reference in New Issue