Skip to content

Commit e91771d

Browse files
committed
Add similar post
1 parent a07fc62 commit e91771d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

templates/blog/post-detail.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ <h1 class="mt-4">{{ object.title }}</h1>
2929
{{ object.body }}
3030
<hr>
3131

32+
<h2 class="bg-primary p-2 text-white">Similar posts</h2>
33+
<div class="row">
34+
{% for post in similar_posts %}
35+
<div class="col-md-4">
36+
<div class="card" style="width: 200px">
37+
<div class="card-image-top">
38+
<img src="{{ object.image.url}}" alt="" class="img-fluid">
39+
</div>
40+
<div class="card-body">
41+
<h5 class="card-title">
42+
<a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
43+
</h5>
44+
</div>
45+
</div>
46+
</div>
47+
{% empty %}
48+
There are no similar posts yet.
49+
{% endfor %}
50+
</div>
51+
3252
<!-- Comments Form -->
3353
<div class="card my-4">
3454
<h5 class="card-header">Leave a Comment:</h5>

0 commit comments

Comments
 (0)