blog-single.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {% assign article-id = include.article-id | default: 2 %}
  2. {% assign article = include.article | default: site.data.articles[article-id] %}
  3. {% assign type = include.type | default: 'none' %}
  4. {% assign author = site.data.people[article.author] %}
  5. {% assign liked = include.liked | default: false %}
  6. {% assign truncate = include.truncate | default: 100 %}
  7. {% assign avatar = article.author %}
  8. {% capture card-content %}
  9. <h3 class="card-title"><a href="#">{{ article.title }}</a></h3>
  10. <div class="text-secondary">{{ article.description | truncate: truncate }}</div>
  11. <div class="d-flex align-items-center pt-4 mt-auto">
  12. {% include ui/avatar.html person-id=avatar %}
  13. <div class="ms-3">
  14. <a href="{{ site.base }}/profile.html" class="text-body">{{ author.first_name }} {{ author.last_name }}</a>
  15. <div class="text-secondary">3 days ago</div>
  16. </div>
  17. <div class="ms-auto">
  18. <a href="#" class="icon d-none d-md-inline-block ms-3 {% if liked %}text-red{% else %}text-secondary{% endif %}">
  19. {% include ui/icon.html icon="heart" use-svg=true %}
  20. </a>
  21. </div>
  22. </div>
  23. {% endcapture %}
  24. <div class="card d-flex flex-column">
  25. {% if type == 'aside' %}
  26. <div class="row row-0 flex-fill">
  27. <div class="col-md-3">
  28. <a href="#">
  29. <img src="{{ site.base }}/static/photos/{{ site.data.photos[article.image].file }}" class="w-100 h-100 object-cover" alt="Card side image">
  30. </a>
  31. </div>
  32. <div class="col">
  33. <div class="card-body">
  34. {{ card-content }}
  35. </div>
  36. </div>
  37. </div>
  38. {% else %}
  39. {% if type == 'image' %}
  40. <a href="#">
  41. <img class="card-img-top" src="{{ site.base }}/static/photos/{{ site.data.photos[article.image].file }}" alt="{{ article.title | escape}}">
  42. </a>
  43. {% endif %}
  44. <div class="card-body d-flex flex-column">
  45. {{ card-content }}
  46. </div>
  47. {% endif %}
  48. </div>