Composite

PostCard

A blog post card. The title is the one link, and the whole card is its target.

Basic

The date and reading time sit above the title. On a collection page, CollectionList builds these props from each entry, so you rarely write them by hand.

An open dictionary showing the entry for Esperanto

Oct 15, 2026 · 2 min read

Translations live in a folder per language and link by filename.

  • i18n
basic
---
import PostCard from '@alfadormx/blocks/composite/PostCard.astro';

const post = {
  headline: { title: 'Writing in two languages' },
  href: '/demos/saas/blog/second-post',
  description: 'Translations live in a folder per language and link by filename.',
  date: new Date('2026-10-15T12:00:00Z'),
  readingTime: 2,
  tags: ['i18n'],
  image: {
    src: '~/assets/images/content/dictionary-page.jpg',
    alt: 'An open dictionary showing the entry for Esperanto',
  },
};
---

<div class="max-w-sm">
  <PostCard {...post} />
</div>

Without a cover

Leave out image for a text-only card. readingTime: false hides the reading time.

no-cover
---
import PostCard from '@alfadormx/blocks/composite/PostCard.astro';

const post = {
  headline: { title: 'Writing in two languages' },
  href: '/demos/saas/blog/second-post',
  description: 'Translations live in a folder per language and link by filename.',
  date: new Date('2026-10-15T12:00:00Z'),
  readingTime: 2,
  tags: ['i18n'],
  image: {
    src: '~/assets/images/content/dictionary-page.jpg',
    alt: 'An open dictionary showing the entry for Esperanto',
  },
};
---

<div class="max-w-sm">
  <PostCard {...post} image={undefined} readingTime={false} />
</div>

Language

langCode picks the date format and the UI strings. Spanish ships with the library; other languages fall back to English, and readMoreLabel overrides the text.

An open dictionary showing the entry for Esperanto

15 oct 2026 · 2 min de lectura

Las traducciones viven en una carpeta por idioma.

  • i18n
language
---
import PostCard from '@alfadormx/blocks/composite/PostCard.astro';

const post = {
  headline: { title: 'Writing in two languages' },
  href: '/demos/saas/blog/second-post',
  description: 'Translations live in a folder per language and link by filename.',
  date: new Date('2026-10-15T12:00:00Z'),
  readingTime: 2,
  tags: ['i18n'],
  image: {
    src: '~/assets/images/content/dictionary-page.jpg',
    alt: 'An open dictionary showing the entry for Esperanto',
  },
};
---

<div class="max-w-sm">
  <PostCard
    {...post}
    headline={{ title: 'Escribir en dos idiomas' }}
    href="/es/demos/saas/blog/segunda-entrada"
    description="Las traducciones viven en una carpeta por idioma."
    langCode="es"
  />
</div>

API Reference

PropTypeDefaultDescription
headlineHeadlineProps—Card title; the title text is the card's one link and its accessible name (default: htmlTag 'h3').
hrefstring—Entry URL; the whole card is one link.
descriptionstring—Excerpt under the title.
imageImageProps—Cover image above the title.
tagsstring[]—Tags in the card footer (default: []).
langCodestring—Language of the card's dates and UI strings (default: the site's default language).
classstring—Classes on the card root (`data-entry-card`).
eyebrowClassstring—Classes on the eyebrow line above the title (`data-entry-card-eyebrow`).
tagsClassstring—Classes on the tags list (`data-entry-card-tags`).
dateDate—Publication date, formatted in the card language's locale.
readingTimenumber | false—Minutes to read, shown after the date; `false` or unset hides it.
readMoreLabelstring—Visual "Read more" text; hidden from assistive tech, since the title is the link (default: per-language string).