Post card
Description
A listing card for an article, a portfolio project or an external post.
Pass page to fill the card from a Wagtail page: its title, URL, first
published date, lead image and description (a project's summary, else
the search description), plus tags on pages that have them. Any param
passed explicitly wins, so date=None hides the date on a project.
Without a page, title and url are required.
The image sits in a fixed 3:2 frame so cards in a row line up whatever
the source image's shape. Pass a rendition at least 720x480 so it stays
sharp on high-density screens. Without an image the frame is left out and
the card starts with its text. Tags sit at the foot of the card and link
to the filtered listing when filter_url is set.
Usage
From a page
{% post_card page=page %} fills the title, link, date, image and description from the page. This example uses the newest live article, or a placeholder page if there are none.
{% post_card page=page %}
All parameters
Every param passed explicitly, with no page.
{% post_card
title="Converting Django models and Wagtail pages"
url="#"
date=2025-01-10
description="Discussing the complexities and approaches for converting an existing Wagtail page between page types."
image_url="https://picsum.photos/seed/jafacakes/720/480"
image_alt=""
tags=['Django', 'Wagtail']
filter_url="#"
%}
Qualified tag usage
{% ui__post_card page=page %}
Parameters
| Name | Type | Requirement | Default | Choices | Description |
|---|---|---|---|---|---|
page
|
Page
|
Optional | — | — | Page to fill the card from. |
title
|
str
|
Optional | — | — | Post title. |
url
|
str
|
Optional | — | — | Link to the post. |
date
|
date | datetime
|
Optional | — | — | Publish date. |
description
|
str
|
Optional | — | — | One or two sentence summary. |
image_url
|
str
|
Optional | — | — | Card image URL. |
image_alt
|
str
|
Optional |
|
— | Alt text for the image. |
tags
|
list
|
Optional | — | — | Tech tags (objects with name/slug, or strings). |
filter_url
|
str
|
Optional | — | — | Listing URL for tag filter links. |
{% post_card page=page %}
<article class="post-card ">
<div class="post-card__media">
<img src="https://picsum.photos/seed/jafacakes/720/480" alt="" loading="lazy">
</div>
<div class="post-card__body">
<p class="post-card__meta"><time class="post-date pill" datetime="2025-01-10">10 Jan 2025</time>
</p>
<h2 class="post-card__title">
<a class="post-card__link" href="#">Converting Django models and Wagtail pages</a>
</h2>
<p class="post-card__desc">Discussing the complexities and approaches for converting an existing Wagtail page between page types.</p>
<div class="post-card__tags"><ul class="tag-list " aria-label="Tech">
<li class="tag-list__item">
<span class="tag-list__tag">Django</span>
</li>
<li class="tag-list__item">
<span class="tag-list__tag">Wagtail</span>
</li>
</ul>
</div>
</div>
</article>