Marketing sectionsPostList
Searchastronomic.dev# PostList
To list posts as rows of text, newest first, with the dates in a column.
Static: no JavaScript.
## Usage
```astro
import PostList from "@astronomic-dev/ui/components/PostList.astro";
```
## Examples
### All writing
Five posts as rows of text on hairlines, newest first, the last row closed with a rule below. From a 42rem posts container the date and reading time take their own start column; below that they sit above the title. The dates print in the default "en" style (Oct 14, 2026); set locale for another language. A row shows no picture and no author; the last post has no excerpt.
```astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// Newest first. Dates are "YYYY-MM-DD" strings, printed as "Oct 14, 2026" (set locale for another language).
const posts = [
{
href: "#launch-checklist",
title: "A launch checklist for a small studio site",
date: "2026-10-14",
readingTime: "6 min read",
excerpt: "The twelve checks we run the week before a site goes live, from redirects and page titles to the contact form and the 404 page.",
topic: { label: "Process", href: "#topic-process" },
},
{
href: "#sketch-first",
title: "Sketch the page before the first pixel",
date: "2026-10-02",
readingTime: "4 min read",
excerpt: "Why every Astronomic project starts with a pencil, and what the sketches settle before the design begins.",
topic: { label: "Design", href: "#topic-design" },
},
{
href: "#content-move",
title: "Moving an old site's content without losing a page",
date: "2026-09-18",
readingTime: "8 min read",
excerpt: "A spreadsheet, a redirect map and one rule: every old address still leads somewhere useful on the day the new site opens.",
topic: { label: "Content", href: "#topic-content" },
},
{
href: "#editors",
title: "Letting editors change pages without breaking them",
date: "2026-09-04",
excerpt: "How we set up the editing side of a site, so a new page or a new case study never needs a developer.",
topic: { label: "Editing", href: "#topic-editing" },
},
{ href: "#fonts", title: "Choosing two fonts for a site", date: "2026-08-21", readingTime: "3 min read", topic: { label: "Design", href: "#topic-design" } },
];
---
<div class="mx-auto max-w-4xl px-6 py-16">
<PostList heading="All writing" text="Notes on planning, designing and building sites, newest first." items={posts} />
</div>
```
### In German
locale="de" prints the dates as 14.10.2026, on a page (here, a wrapper) with lang="de". The <time datetime> stays 2026-10-14 in every language. The heading, the text and the view-all label are your own words, in the page's language.
```astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// A German blog: locale="de" prints the dates as 14.10.2026. The <time datetime> stays 2026-10-14.
const posts = [
{
href: "#checkliste",
title: "Eine Checkliste für den Start einer Website",
date: "2026-10-14",
readingTime: "6 Min. Lesezeit",
excerpt: "Die zwölf Punkte, die wir in der Woche vor dem Start prüfen, von Weiterleitungen bis zum Kontaktformular.",
topic: { label: "Ablauf", href: "#thema-ablauf" },
},
{
href: "#skizzen",
title: "Erst die Skizze, dann das Design",
date: "2026-10-02",
excerpt: "Warum jedes Projekt bei Astronomic mit einem Bleistift beginnt.",
topic: { label: "Design", href: "#thema-design" },
},
{ href: "#schriften", title: "Zwei Schriften für eine Website", date: "2026-09-18", topic: { label: "Design", href: "#thema-design" } },
];
---
<div class="mx-auto max-w-4xl px-6 py-16" lang="de">
<PostList heading="Aus dem Studio" items={posts} locale="de" viewAll={{ label: "Alle Beiträge", href: "#blog" }} />
</div>
```
### Without dates
Four rows: a date and reading time, a date only, a reading time only, and neither. With neither, the title still sits in the second column from a 42rem posts container, so the titles line up.
```astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// A post's date is optional. One row per state: a date and reading time, a date only, a reading time only, neither.
const posts = [
{ href: "#launch-checklist", title: "A launch checklist for a small studio site", date: "2026-10-14", readingTime: "6 min read", excerpt: "The twelve checks we run the week before a site goes live." },
{ href: "#sketch-first", title: "Sketch the page before the first pixel", date: "2026-10-02", excerpt: "What the pencil sketches settle before the design begins." },
{ href: "#how-we-work", title: "How we work with a new client", readingTime: "5 min read", excerpt: "From the first call to the handover, in five steps." },
{ href: "#studio-tools", title: "The tools on our desks", excerpt: "A page we keep up to date, so it has no date of its own." },
];
---
<div class="mx-auto max-w-4xl px-6 py-16">
<PostList heading="Notes" items={posts} />
</div>
```
## Props
### PostList
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | The section heading, in the title role in display type. Without it there is no section and no header: a plain <div> holds only the posts. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside, as in "Built for *the long run*". Any other asterisks show as typed. Off by default, so the heading shows as typed. How the <em> looks is the theme's. |
| `mark` | `string` | None | A short mark after the heading, such as "(12)" or "©2026", in small muted type. It sits beside the heading, outside it, so the heading's name stays plain. Shown only with a heading. |
| `markLabel` | `string` | None | What the mark says to a screen reader, such as "12 projects": the mark is then hidden from screen readers and this is read in its place. Without it, the mark is read as written. |
| `text` | `string` | None | One or two sentences under the heading, in the lead role, muted. Shown only with a heading. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. Each post title sits one level under it. |
| `viewAll` | `PostsLink` | None | A link after the list: { label, href } (PostsLink), such as { label: "All posts", href: "/blog" }. Name the page, not "More". |
| `empty` | `string` | None | Text shown in place of the list when there are no posts, such as "No posts yet.". Without it, no posts render no list and no text. |
| `class` | `string` | None | More classes for the root (the <section>, or the <div> without a heading), merged with cn(), so yours win on conflicts. The root is a named size container (inline-size containment): in a shrink-to-fit parent (inline-flex, a float, fit-content) it collapses, so give it a width there. |
| `itemHeadingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | `"h3"` | The title element when there is no heading. With a heading, titles sit one level under it. |
| `items` | `PostItem[]` | None | Required. The posts, newest first (the order you pass): { href, title, date?, dateLabel?, excerpt?, image?, topic?, author?, readingTime? } (PostItem). date (optional) is "YYYY-MM-DD", such as "2026-10-14" (the canonical form), or a Date read in UTC, as Astro content collections give. new Date(2026, 9, 14) is local midnight, which shows the day before east of UTC: pass the string instead. A bad value throws at build time with the value in the message, so no page says "Invalid Date". dateLabel is your own text in place of the printed date ("Updated 3 days ago"); the datetime stays the date, and it shows only with a date. image is { src, width?, height?, ratio?, focalPoint?, loading? }, with no alt: the part writes alt="", since the title says what the post is. topic is { label, href? }; author is { name, image? }; readingTime is your own text, such as "5 min read". Only these fields reach each post, so a CMS entry's other fields never reach the page. With none, the empty text shows, or nothing. A row shows no image and no author. |
| `locale` | `string` | `"en"` | The dates' language, such as "de" (14.10.2026); the default prints "Oct 14, 2026". Passed to every post (formatDate in lib/date.ts). The dates are read in UTC, so the day never moves with the time zone. |
| Slot | Description |
| --- | --- |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
Any other attribute goes on the <section>, or on the <div> without a heading.
## Accessibility
- With a heading, renders a <section> named by it, so it is a region landmark. The heading id is unique on the page.
- Without a heading, renders a plain <div>. Put your own heading above it.
- The posts are a list (<ul role="list">), so a screen reader says how many there are. Each post is an <article> in its <li>.
- Each title sits one level under the section heading (h2 gives h3), so a reader can jump from post to post. With no heading, it is an h3 unless you set itemHeadingTag.
- The title is the only link to the post, so a screen reader's list of links reads each title once, with no "Read more". On a card the whole card is clickable, and the title names it: the focus ring goes round the card.
- The topic is a link of its own to the topic's page. On a card it leads the meta line above the title, so Tab reaches it before the title; in a row it sits under the excerpt, so Tab reaches it after the title. Either way the Tab order is the reading order.
- The date is a <time> with a machine date (datetime="2026-10-14"), whatever the text says.
- With no posts the list is left out: the empty text shows in its place when you give one. With no posts and no empty text, leave the section out, or it is a heading over nothing.
- The view-all link comes after the posts. Name the page it opens ("All posts"), not "More". On touch screens it is a box of 44px at least.
PostList
FreeTo list posts as rows of text, newest first, with the dates in a column.
- File
- PostList.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 3
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
All writing
Five posts as rows of text on hairlines, newest first, the last row closed with a rule below. From a 42rem posts container the date and reading time take their own start column; below that they sit above the title. The dates print in the default "en" style (Oct 14, 2026); set locale for another language. A row shows no picture and no author; the last post has no excerpt.
This preview did not load.
examples/postlist/main.astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// Newest first. Dates are "YYYY-MM-DD" strings, printed as "Oct 14, 2026" (set locale for another language).
const posts = [
{
href: "#launch-checklist",
title: "A launch checklist for a small studio site",
date: "2026-10-14",
readingTime: "6 min read",
excerpt: "The twelve checks we run the week before a site goes live, from redirects and page titles to the contact form and the 404 page.",
topic: { label: "Process", href: "#topic-process" },
},
{
href: "#sketch-first",
title: "Sketch the page before the first pixel",
date: "2026-10-02",
readingTime: "4 min read",
excerpt: "Why every Astronomic project starts with a pencil, and what the sketches settle before the design begins.",
topic: { label: "Design", href: "#topic-design" },
},
{
href: "#content-move",
title: "Moving an old site's content without losing a page",
date: "2026-09-18",
readingTime: "8 min read",
excerpt: "A spreadsheet, a redirect map and one rule: every old address still leads somewhere useful on the day the new site opens.",
topic: { label: "Content", href: "#topic-content" },
},
{
href: "#editors",
title: "Letting editors change pages without breaking them",
date: "2026-09-04",
excerpt: "How we set up the editing side of a site, so a new page or a new case study never needs a developer.",
topic: { label: "Editing", href: "#topic-editing" },
},
{ href: "#fonts", title: "Choosing two fonts for a site", date: "2026-08-21", readingTime: "3 min read", topic: { label: "Design", href: "#topic-design" } },
];
---
<div class="mx-auto max-w-4xl px-6 py-16">
<PostList heading="All writing" text="Notes on planning, designing and building sites, newest first." items={posts} />
</div>In German
locale="de" prints the dates as 14.10.2026, on a page (here, a wrapper) with lang="de". The <time datetime> stays 2026-10-14 in every language. The heading, the text and the view-all label are your own words, in the page's language.
This preview did not load.
examples/postlist/locale.astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// A German blog: locale="de" prints the dates as 14.10.2026. The <time datetime> stays 2026-10-14.
const posts = [
{
href: "#checkliste",
title: "Eine Checkliste für den Start einer Website",
date: "2026-10-14",
readingTime: "6 Min. Lesezeit",
excerpt: "Die zwölf Punkte, die wir in der Woche vor dem Start prüfen, von Weiterleitungen bis zum Kontaktformular.",
topic: { label: "Ablauf", href: "#thema-ablauf" },
},
{
href: "#skizzen",
title: "Erst die Skizze, dann das Design",
date: "2026-10-02",
excerpt: "Warum jedes Projekt bei Astronomic mit einem Bleistift beginnt.",
topic: { label: "Design", href: "#thema-design" },
},
{ href: "#schriften", title: "Zwei Schriften für eine Website", date: "2026-09-18", topic: { label: "Design", href: "#thema-design" } },
];
---
<div class="mx-auto max-w-4xl px-6 py-16" lang="de">
<PostList heading="Aus dem Studio" items={posts} locale="de" viewAll={{ label: "Alle Beiträge", href: "#blog" }} />
</div>Without dates
Four rows: a date and reading time, a date only, a reading time only, and neither. With neither, the title still sits in the second column from a 42rem posts container, so the titles line up.
This preview did not load.
examples/postlist/undated.astro
---
import PostList from "@astronomic-dev/ui/components/PostList.astro";
// A post's date is optional. One row per state: a date and reading time, a date only, a reading time only, neither.
const posts = [
{ href: "#launch-checklist", title: "A launch checklist for a small studio site", date: "2026-10-14", readingTime: "6 min read", excerpt: "The twelve checks we run the week before a site goes live." },
{ href: "#sketch-first", title: "Sketch the page before the first pixel", date: "2026-10-02", excerpt: "What the pencil sketches settle before the design begins." },
{ href: "#how-we-work", title: "How we work with a new client", readingTime: "5 min read", excerpt: "From the first call to the handover, in five steps." },
{ href: "#studio-tools", title: "The tools on our desks", excerpt: "A page we keep up to date, so it has no date of its own." },
];
---
<div class="mx-auto max-w-4xl px-6 py-16">
<PostList heading="Notes" items={posts} />
</div>