mirror of
https://github.com/ViViDboarder/Vivid-Casper.git
synced 2024-11-14 17:26:36 +00:00
50 lines
2.1 KiB
Handlebars
50 lines
2.1 KiB
Handlebars
{{!-- This is a partial file used to generate a post "card"
|
|
which templates loop over to generate a list of posts. --}}
|
|
|
|
<article class="post-card {{post_class}} {{#match @custom.feed_layout "!=" "Simple grid"}}{{#is "home, paged"}}{{#match @custom.feed_layout "Dynamic grid"}}{{#has index="0"}}{{#is "home"}}{{#if feature_image}}post-card-large{{/if}}{{/is}}{{/has}}{{else}}post-card-large{{/match}}{{/is}}{{/match}}">
|
|
|
|
{{#if feature_image}}
|
|
<a class="post-card-image-link" href="{{url}}">
|
|
{{!-- This is a responsive image, it loads different sizes depending on device
|
|
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
|
|
<img class="post-card-image"
|
|
srcset="{{img_url feature_image size="s"}} 300w,
|
|
{{img_url feature_image size="m"}} 600w,
|
|
{{img_url feature_image size="l"}} 1000w,
|
|
{{img_url feature_image size="xl"}} 2000w"
|
|
sizes="(max-width: 1000px) 400px, 800px"
|
|
src="{{img_url feature_image size="m"}}"
|
|
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
|
|
loading="lazy"
|
|
/>
|
|
</a>
|
|
{{/if}}
|
|
|
|
<div class="post-card-content">
|
|
|
|
<a class="post-card-content-link" href="{{url}}">
|
|
<header class="post-card-header">
|
|
{{#if primary_tag}}
|
|
{{#primary_tag}}
|
|
<div class="post-card-primary-tag">{{name}}</div>
|
|
{{/primary_tag}}
|
|
{{/if}}
|
|
<h2 class="post-card-title">{{title}}</h2>
|
|
</header>
|
|
{{#if excerpt}}
|
|
<div class="post-card-excerpt">{{excerpt}}</div>
|
|
{{/if}}
|
|
</a>
|
|
|
|
<footer class="post-card-meta">
|
|
<time class="post-card-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
|
|
{{#if reading_time}}
|
|
<span class="sep">—</span>
|
|
<span class="post-card-meta-length">{{reading_time}}</span>
|
|
{{/if}}
|
|
</footer>
|
|
|
|
</div>{{!--/.post-card-content--}}
|
|
|
|
</article>
|