Add coverCaption param to post frontmatter

This commit is contained in:
Zachary Porter 2020-07-04 09:28:29 -04:00 committed by panr
parent 149fb37220
commit d4d477e3b6
4 changed files with 17 additions and 7 deletions

View File

@ -188,6 +188,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 `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

View File

@ -32,11 +32,17 @@
{{ end }}
{{ if .Params.Cover }}
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" class="post-cover" />
{{ else }}
<img src="{{ .Params.Cover | absURL }}" class="post-cover" />
{{ end }}
<figure class="post-cover">
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" />
{{ else }}
<img src="{{ .Params.Cover | absURL }}" />
{{ end }}
{{ if .Params.CoverCaption }}
<figcaption class="center">{{ .Params.CoverCaption | markdownify }}</figcaption>
{{ end }}
</figure>
{{ end }}
<div class="post-content">

View File

@ -55,7 +55,10 @@
margin: 40px -50px;
width: 860px;
max-width: 860px;
box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
img {
box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
}
@media (--tablet) {
margin: 20px 0;

File diff suppressed because one or more lines are too long