mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-21 23:35:08 +01:00
Merge pull request #201 from shinytoyrobots/improved-cover-alt-text
Added custom alt text functionality to post cover images
This commit is contained in:
commit
2e9d54fb77
@ -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
|
||||
|
@ -45,9 +45,9 @@
|
||||
{{ if .Params.Cover }}
|
||||
<figure class="post-cover">
|
||||
{{ if .Params.UseRelativeCover }}
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}"/>
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}"/>
|
||||
{{ else }}
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}"/>
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}"/>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.CoverCaption }}
|
||||
|
@ -30,9 +30,9 @@
|
||||
{{ if .Params.Cover }}
|
||||
<figure class="post-cover">
|
||||
{{ if .Params.UseRelativeCover }}
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}" />
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}" />
|
||||
{{ else }}
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}" />
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.CoverCaption }}
|
||||
|
@ -34,9 +34,9 @@
|
||||
{{ if .Params.Cover }}
|
||||
<figure class="post-cover">
|
||||
{{ if .Params.UseRelativeCover }}
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}" />
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}" />
|
||||
{{ else }}
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}" />
|
||||
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Params.CoverAlt | plainify | default .Title }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.CoverCaption }}
|
||||
|
Loading…
Reference in New Issue
Block a user