From 4c9276c71ded22fb712e3e4354a0339ed7f2bf7c Mon Sep 17 00:00:00 2001 From: shinytoyrobots Date: Wed, 9 Sep 2020 00:27:13 -0500 Subject: [PATCH] Added custom alt text functionality to post cover images --- README.md | 1 + layouts/_default/index.html | 4 ++-- layouts/_default/list.html | 4 ++-- layouts/_default/single.html | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9af3fa4..f3ae274 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ Adding a cover image to your post is simple and there are two options when you e * Resulting in `https://www.yourpage.com/path/to/absolute/img.jpg` * Use `cover = "img.jpg"` and `useRelativeCover = true` to link the image relative to the blog post folder * Resulting in `https://www.yourpage.com/posts/blog-entry-xy/img.jpg` +* Use `coverAlt = "description of image"` to add custom alt text to the cover image (defaults to post or page title as alt text) * Use `coverCaption = "Image Credit to [Barry Bluejeans](https://unsplash.com/)"` to add a caption for the cover image. ## How to display the Last Modified Date in your posts diff --git a/layouts/_default/index.html b/layouts/_default/index.html index 739f38c..d349856 100644 --- a/layouts/_default/index.html +++ b/layouts/_default/index.html @@ -45,9 +45,9 @@ {{ if .Params.Cover }}
{{ if .Params.UseRelativeCover }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ else }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ end }} {{ if .Params.CoverCaption }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 39a6be0..c60d853 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -30,9 +30,9 @@ {{ if .Params.Cover }}
{{ if .Params.UseRelativeCover }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ else }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ end }} {{ if .Params.CoverCaption }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1e766ca..e94ef00 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -34,9 +34,9 @@ {{ if .Params.Cover }}
{{ if .Params.UseRelativeCover }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ else }} - {{ .Title | plainify | default + {{ .Params.CoverAlt | plainify | default .Title }} {{ end }} {{ if .Params.CoverCaption }}