bmen-jekyll/_includes/blog/post-card.html

49 lines
1.7 KiB
HTML

{%- comment -%} Default Styles {%- endcomment -%}
{%- assign card_style = '' -%}
{%- assign text_style = 'text-dark' -%}
{%- assign badge_style = 'badge-dark' -%}
{%- comment -%} Update Styles {%- endcomment -%}
{%- if post.style == 'fill' -%}
{%- assign card_style = post.color | prepend: 'bg-' -%}
{%- if post.color != 'light' -%}
{%- assign text_style = 'text-white' -%}
{%- assign badge_style = 'badge-light text-' -%}
{%- assign badge_style = badge_style | append: post.color -%}
{%- endif -%}
{%- else -%}
{%- assign card_style = post.color | prepend: 'border border-' -%}
{%- if post.color -%}
{%- assign badge_style = post.color | prepend: 'badge-' -%}
{%- endif -%}
{%- endif -%}
{%- comment -%} Determine Post URL {%- endcomment -%}
{%- if post.external_url -%}
{%- assign post_url = post.external_url -%}
{%- else -%}
{%- assign post_url = post.url | relative_url -%}
{%- endif -%}
<div class="col-lg-6 my-3 wow animated fadeIn" data-wow-delay=".15s">
<a href="{{ post_url }}.html" class="post card {{ card_style }}">
<div class="card-body {{ text_style }}">
<h3 class="card-title">{{ post.title }}</h3>
<p class="card-text">
{% for tag in post.tags %}
<span class="badge {{ badge_style }}">{{ tag }}</span>
{% endfor %}
</p>
<p class="card-text">
{%- if post.description -%}
{{ post.description }}
{%- else -%}
{{ post.content | truncatewords: 25, "<small><i> read more...</i></small>" }}
{%- endif -%}
</p>
</div>
<div class="card-footer {{ text_style }}">
{{ post.date | date_to_long_string }}
</div>
</a>
</div>