add teaser image support

This commit is contained in:
Matthew Tran 2023-07-05 00:40:06 -07:00
parent 1a4a33f297
commit e032a187f0
5 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,35 @@
{% if post.header.teaser %}
{% capture teaser %}{{ post.header.teaser }}{% endcapture %}
{% else %}
{% assign teaser = site.teaser %}
{% endif %}
{% if post.id %}
{% assign title = post.title | markdownify | remove: "<p>" | remove: "</p>" %}
{% else %}
{% assign title = post.title %}
{% endif %}
<div class="{{ include.type | default: 'list' }}__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
{% if include.type == "grid" and teaser %}
<div class="archive__item-teaser">
<img src="{{ teaser | relative_url }}" alt="">
</div>
{% endif %}
<h2 class="archive__item-title no_toc" itemprop="headline">
{% if post.link %}
<a href="{{ post.link }}">{{ title }}</a> <a href="{{ post.url | relative_url }}" rel="permalink"><i class="fas fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
{% else %}
<a href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
{% endif %}
</h2>
{% include page__meta.html type=include.type %}
{% if include.type == "list" and teaser %}
<div class="archive__item-teaser">
<img style="max-height: 15vh; width: auto; height: auto" src="{{ teaser | relative_url }}" alt="">
</div>
{% endif %}
{% if post.excerpt %}<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify | strip_html | truncate: 160 }}</p>{% endif %}
</article>
</div>

View File

@ -0,0 +1 @@
<link rel="shortcut icon" type="image/png" href="/assets/img/favicon.png">

View File

@ -3,6 +3,8 @@ title: "Moving to Jekyll"
date: 2023-07-03 date: 2023-07-03
categories: other categories: other
excerpt: After several years on WordPress, I realized my use case would be better suited for a static generator like Jekyll. To better maintainability and security! excerpt: After several years on WordPress, I realized my use case would be better suited for a static generator like Jekyll. To better maintainability and security!
header:
teaser: /assets/img/jekyll_logo.png
--- ---
Nothing much to see here. If the process gets rocky, I'll add some comments. Nothing much to see here. If the process gets rocky, I'll add some comments.

BIN
assets/img/favicon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
assets/img/jekyll_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB