Marking Up Posts with Microformats2 h-entry
h-entry, h-card, h-feed and u-syndication classes on articles, notes and photos of an Astro site, machine-readable without any visible change.
Reviewed by adrian
on
With my identity verified through rel=me and h-card (Joining the IndieWeb), the next job on my old site was the single posts. I wanted parsers and IndieWeb services to read title, date, author and body without guessing, and without a separate metadata file next to every page.
Microformats2 (MF2) does this with CSS class names on the existing HTML. No new elements, no JSON-LD in the head: the structure lives in the markup.
The setup
- Astro 6, a static site with one layout per collection: articles, notes and photo sets.
- Goal: add
h-entry,p-name,dt-published,e-content,h-cardandh-feedto the existing templates without changing how anything looks.
An h-entry
h-entry marks a post, and everything else hangs off it. A minimal article:
<article class="h-entry">
<a href="https://adrian-altner.de/articles/..." class="u-url" hidden>Permalink</a>
<h1 class="p-name">Article Title</h1>
<time class="dt-published" datetime="2026-03-23T00:00:00.000Z">March 23, 2026</time>
<div class="e-content">
<!-- article body -->
</div>
</article>
h-entry: the root, marks the element as a post.u-url: the canonical URL of the post.p-name: the title, as plain text.dt-published: the publication date, read fromdatetime.e-content: the full body, parsed as HTML.
The author
A post on its own does not say who wrote it. The author goes into the h-entry as a nested h-card. It is the same on every page, so it is hidden from view but there for parsers:
<span class="p-author h-card" style="display:none">
<img class="u-photo" src="https://adrian-altner.de/avatar.jpg" alt="Adrian Altner" />
<span class="p-name">Adrian Altner</span>
<a class="u-url" href="https://adrian-altner.de">adrian-altner.de</a>
</span>
A parser reads it as "the author of this entry is the person in this h-card".
Notes and photos
Notes use the same structure. They have no real title, so p-name is the first sentence and e-content the full body.
A photo gets its own h-entry with u-photo on the <img>:
<article class="h-entry">
<img class="u-photo" src="..." alt="..." />
<h1 class="p-name">Photo Title</h1>
<time class="dt-published" datetime="2025-10-06T00:00:00.000Z">October 6, 2025</time>
</article>
A grid of photos becomes an h-feed, a collection of entries, through one class on the container:
<div class="h-feed">
<div class="h-entry">...</div>
<div class="h-entry">...</div>
</div>
Syndication links
When a post has been copied to Bluesky or elsewhere, parsers need a way to find the copy. u-syndication marks it:
<a class="u-syndication" href="https://bsky.app/profile/...">Also on Bluesky</a>
The URLs lived in the frontmatter and were rendered when present:
syndication: z.array(z.string().url()).optional(),
{post.data.syndication?.map((url) => (
<a class="u-syndication" href={url}>{new URL(url).hostname}</a>
))}
This link is what later lets Bridgy match reactions on the copy to the original (Bluesky reactions as webmentions).
Checking it
None of this changes the page. The classes do nothing in CSS unless you target them. The only additions are the hidden permalink and the hidden author h-card. indiewebify.me validated the h-entry on the first pass and found author, title, date and content.
Takeaways
- MF2 is markup, not metadata. The HTML that renders the page carries the meaning, with no sidecar files.
- A hidden author
h-cardis fine. The author is the same on every page, so there is no reason to show it. - Declare the copies.
u-syndicationis what makes backfeed from social networks possible.
Based on
-
Microformats2: Marking Up Posts for the IndieWeb
(
raw/2026/2026-03-23/microformats2-marking-up-posts-for-the-indieweb.md) [post]
Topic
- IndieWeb Publishing on your own domain first and connecting personal websites with open standards such as Webmention and Microformats.
Basis for
- Receiving and Sending Webmentions Incoming webmentions through webmention.io, rendered at build time in Astro, and outgoing ones sent by webmention.app after every deploy.
Uses
- Astro Tool for building websites from content such as Markdown. Ships plain HTML by default and only loads JavaScript where it is needed.
Mentioned in
- Joining the IndieWeb Why I made my own domain the canonical home of everything I publish, and how rel=me and h-card verified my identity on the old site.
- Syndication Links from State Astro imports the syndication state file at build time and renders u-syndication links on every post, so the frontmatter never needs a second edit.
Mentioned
- Bluesky Reactions as Webmentions with Bridgy Bridgy polls Bluesky for likes, reposts and replies to syndicated posts and sends them back as webmentions, so they appear on the original post.