Skip to content

Commit d98eafb

Browse files
authored
Added thumbnail support for blog posts (#1371)
Implemented #425 based on given code. ![image](https://user-images.githubusercontent.com/31376482/234644266-07c1aebd-6a83-482f-8ac2-846fe5c0653d.png) --------- Signed-off-by: George Araujo <[email protected]>
1 parent ecfb9aa commit d98eafb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

_posts/2015-05-15-images.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ date: 2015-05-15 21:01:00
55
description: this is what included images could look like
66
tags: formatting images
77
categories: sample-posts
8+
thumbnail: assets/img/9.jpg
89
---
910
This is an example post with image galleries.
1011

blog/index.html

+12-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ <h2>{{ site.blog_description }}</h2>
5353
{% assign categories = post.categories | join: "" %}
5454

5555
<li>
56-
<h3>
56+
{%- if post.thumbnail -%}
57+
<div class="row">
58+
<div class="col-sm-9">
59+
{%- endif -%}
60+
<h3>
5761
{% if post.redirect == blank %}
5862
<a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
5963
{% else %}
@@ -95,6 +99,13 @@ <h3>
9599
{% endfor %}
96100
{% endif %}
97101
</p>
102+
{%- if post.thumbnail -%}
103+
</div>
104+
<div class="col-sm-3">
105+
<img class="card-img" src="{{post.thumbnail | relative_url}}" style="object-fit: cover; height: 90%" alt="image">
106+
</div>
107+
</div>
108+
{%- endif -%}
98109
</li>
99110

100111
{% endfor %}

0 commit comments

Comments
 (0)