Skip to content

Commit 6a93bac

Browse files
committed
Beautified the relate-posts card.
1 parent 92ba5c6 commit 6a93bac

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

_includes/related-posts.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{% assign post_index = post_index | plus: 1 %}
3838
{% endfor %}
3939

40-
{% unless score_list.size == 0 %}
40+
{% if score_list.size > 0 %}
4141
{% assign score_list = score_list | sort | reverse %}
4242
{% assign count = 0 %}
4343
<div id="related-posts" class="mt-4 mb-4 pb-3">
@@ -47,16 +47,16 @@ <h3 class="pt-2 mt-1 mb-4" data-toc-skip>Related Posts</h3>
4747
{% assign data = score_item | split: ":" %}
4848
{% assign index = data[1] | plus: 0 %}
4949
{% assign post = site.posts[index] %}
50-
<div class="card btn-box-shadow">
50+
<div class="card">
5151
<a href="{{ post.url }}">
5252
<div class="card-body">
53-
<span class="timeago text-muted small">
53+
<span class="timeago small">
5454
{{ post.date | date: POST_DATE }}
5555
<i class="hidden">{{ page.date | date_to_xmlschema }}</i>
5656
</span>
5757
<h3 class="pt-0 mt-2 mb-3" data-toc-skip>{{ post.title }}</h3>
5858
<div class="text-muted small">
59-
<p>{{ post.content | markdownify | strip_html | truncate: 100 }}</p>
59+
<p>{{ post.content | markdownify | strip_html | truncate: 200 }}</p>
6060
</div>
6161
</div>
6262
</a>
@@ -66,6 +66,6 @@ <h3 class="pt-0 mt-2 mb-3" data-toc-skip>{{ post.title }}</h3>
6666
{% break %}
6767
{% endif %}
6868
{% endfor %}
69-
</div><!-- .card-deck -->
69+
</div> <!-- .card-deck -->
7070
</div>
71-
{% endunless %}
71+
{% endif %}

assets/css/_src/main.scss

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ footer .license a {
383383
position: sticky;
384384
top: 2rem;
385385
transition: top 0.2s ease-in-out;
386-
padding-right: 1.5rem;
386+
margin-right: 1.5rem;
387387
margin-top: 3rem;
388388
margin-bottom: 6rem;
389389
color: #6c757d;
@@ -859,16 +859,26 @@ table tbody td {
859859
}
860860

861861
#related-posts .card {
862-
border: none;
863-
-webkit-transition: all .5s ease-in-out;;
864-
-moz-transition: all .5s ease-in-out;;
865-
transition: all .5s ease-in-out;
862+
border: 1px solid #f1f1f1;
863+
box-shadow: 0 0 5px 0 rgba(234, 234, 234, 0.7686274509803922);
864+
-webkit-transition: all .3s ease-in-out;;
865+
-moz-transition: all .3s ease-in-out;;
866+
transition: all .3s ease-in-out;
867+
}
868+
869+
#related-posts .card:hover {
870+
-webkit-transform: translate3d(0, -8px, 0);
871+
transform: translate3d(0, -8px, 0);
866872
}
867873

868874
#related-posts .card h3 {
869875
color: #353a3d;
870876
}
871877

878+
#related-posts .timeago {
879+
color: rgba(30,55,70,.4);
880+
}
881+
872882
#related-posts p {
873883
font-size: .9rem;
874884
margin-bottom: .5rem;
@@ -883,10 +893,6 @@ table tbody td {
883893
text-decoration: none;
884894
}
885895

886-
#related-posts .card:hover {
887-
transform: scale(1.05);
888-
}
889-
890896
#related-posts ul {
891897
list-style-type: none;
892898
padding-inline-start: 1.5rem;

0 commit comments

Comments
 (0)