cover image will automatically be used as a thumbnail unless a thumbnail is explicitly provided. thumbnail can also be disabled

This commit is contained in:
Dean Attali 2020-07-05 07:31:33 +00:00
parent 70f7345a29
commit 88464eb569
4 changed files with 18 additions and 5 deletions

View File

@ -129,7 +129,7 @@ Parameter | Description
title | Page or blog post title title | Page or blog post title
subtitle | Short description of page or blog post that goes under the title subtitle | Short description of page or blog post that goes under the title
tags | List of tags to categorize the post. Separate the tags with commas and place them inside square brackets. Example: `[personal, analysis, finance]` tags | List of tags to categorize the post. Separate the tags with commas and place them inside square brackets. Example: `[personal, analysis, finance]`
cover-img | Include a large full-width image at the top of the page. You can either give the path to a single image, or provide a list of images to cycle through (see [my personal website](https://deanattali.com/) as an example). cover-img | Include a large full-width image at the top of the page. You can either provide the path to a single image (eg. `"/path/to/img"`) , or a list of images to cycle through (eg. `["/path/img1", "/path/img2"]`). The first image will also be used as the thumbnail in the feed page. If you want to add a caption to an image, then the image should be provided as `{"/path/to/img" : "Caption of image"}`.
comments | If you want do add comments to a specific page, use `comments: true`. Comments only work if you enable one of the comments providers (Facebook, disqus, staticman, utterances) in `_config.yml` file. Comments are automatically enabled on blog posts but not on other pages; to turn comments off for a specific post, use `comments: false`. comments | If you want do add comments to a specific page, use `comments: true`. Comments only work if you enable one of the comments providers (Facebook, disqus, staticman, utterances) in `_config.yml` file. Comments are automatically enabled on blog posts but not on other pages; to turn comments off for a specific post, use `comments: false`.
## Less commonly used parameters ## Less commonly used parameters
@ -140,7 +140,7 @@ Parameter | Description
----------- | ----------- ----------- | -----------
readtime | If you want a post to show how many minutes it will take to read it, use `readtime: true`. readtime | If you want a post to show how many minutes it will take to read it, use `readtime: true`.
show-avatar | If you have an avatar configured in the `_config.yml` but you want to turn it off on a specific page, use `show-avatar: false`. show-avatar | If you have an avatar configured in the `_config.yml` but you want to turn it off on a specific page, use `show-avatar: false`.
thumbnail-img | For blog posts, if you want to add a thumbnail that'll show up next to the post's excerpt in the feed, use `thumbnail-img: /path/to/image`. thumbnail-img | For blog posts, if you want to add a thumbnail that'll show up next to the post's excerpt in the feed, use `thumbnail-img: /path/to/image`. You can use `thumbnail-img: ""` to disable a thumbnail.
share-img | If you want to specify an image to use when sharing the page on Facebook or Twitter, then provide the image's path or full URL here. share-img | If you want to specify an image to use when sharing the page on Facebook or Twitter, then provide the image's path or full URL here.
social-share | By default, every blog post has buttons to share the page on social media. If you want to turn this feature off, use `social-share: false`. social-share | By default, every blog post has buttons to share the page on social media. If you want to turn this feature off, use `social-share: false`.
nav-short | By default, the navigation bar gets shorter after scrolling down the page. If you want the navigation bar to always be short on a certain page, use `nav-short: true` nav-short | By default, the navigation bar gets shorter after scrolling down the page. If you want the navigation bar to always be short on a certain page, use `nav-short: true`

View File

@ -25,10 +25,23 @@ layout: page
</p> </p>
<div class="post-entry-container"> <div class="post-entry-container">
{% if post.thumbnail-img %} {%- capture thumbnail -%}
{% if post.thumbnail-img %}
{{ post.thumbnail-img }}
{% elsif post.cover-img %}
{% if post.cover-img.first %}
{{ post.cover-img[0].first.first }}
{% else %}
{{ post.cover-img }}
{% endif %}
{% else %}
{% endif %}
{% endcapture %}
{% assign thumbnail=thumbnail | strip %}
{% if thumbnail != "" %}
<div class="post-image"> <div class="post-image">
<a href="{{ post.url | relative_url }}"> <a href="{{ post.url | relative_url }}">
<img src="{{ post.thumbnail-img | relative_url }}"> <img src="{{ thumbnail | relative_url }}">
</a> </a>
</div> </div>
{% endif %} {% endif %}

View File

@ -3,7 +3,7 @@ layout: post
title: Flake it till you make it title: Flake it till you make it
subtitle: Excerpt from Soulshaping by Jeff Brown subtitle: Excerpt from Soulshaping by Jeff Brown
cover-img: /assets/img/path.jpg cover-img: /assets/img/path.jpg
thumbnail-img: /assets/img/path.jpg thumbnail-img: "/assets/img/thumb.png"
share-img: /assets/img/path.jpg share-img: /assets/img/path.jpg
tags: [books, test] tags: [books, test]
--- ---

BIN
assets/img/thumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB