--- /** * An article (RFC-0018 §3, the article view): kicker (the primary category), title, dek, byline * (author, published, updated, reading time), cover, an "On this page" table of contents for * longer pieces (headings carry ids; no JavaScript), then the body with the theme's own blocks and * the corrections, newest first (RFC-0019 §2; the latest one is the "Updated" date). Collections * with typed fields (RFC-0041 §9) show their values as a "Details" list under the cover. */ import { Body, EntryFields } from "@cloudhal/astro-renderer/components"; import type { RenderedFields } from "@cloudhal/astro-renderer/fields"; import { articleCorrections, articleOutline } from "@cloudhal/astro-renderer/kit"; import { entryArticleParts } from "@cloudhal/astro-renderer/markdown"; import type { MediaContext } from "@cloudhal/astro-renderer/media"; import type { EntryTaxonomy } from "@cloudhal/astro-renderer/taxonomy"; import type { ContentEntry } from "@cloudhal/core-contracts"; import type { BlockType } from "@cloudhal/core-ts/blocks"; import type { ThemeStrings } from "../theme.ts"; interface Props { entry: ContentEntry; terms: EntryTaxonomy; locale: string; t: ThemeStrings; media?: MediaContext; blocks?: Record; blockTypes?: readonly BlockType[]; /** The entry's typed fields (`source.entryFields`); absent or empty draws nothing. */ fields?: RenderedFields; } const { entry, terms, locale, t, media, blocks, blockTypes, fields } = Astro.props; const parts = entryArticleParts(entry, locale, media); const outline = articleOutline(entry); const date = (iso: string) => new Date(iso).toLocaleDateString(locale, { year: "numeric", month: "long", day: "numeric" }); const published = entry.publishedAt ?? undefined; const corrections = articleCorrections(entry); const newest = corrections.items[0]; // "Updated": the latest correction; without one, only a real later edit, not the publish itself. const updated = corrections.latest ?? (published && Date.parse(entry.updatedAt) - Date.parse(published) > 24 * 3600 * 1000 ? entry.updatedAt : undefined); // RFC-0019 §1: the byline's authors link to their pages; without one, a person who wrote it. const authors = terms.authors; const author = authors.length === 0 && entry.author.kind === "human" ? entry.author.name : undefined; ---
{terms.section && ( terms.section.href ? ( {terms.section.name} ) : ( {terms.section.name} ) )}

{entry.title}

{entry.summary &&

{entry.summary}

}
{fields && } {outline.toc.length >= 3 && (
{t.onThisPage}
    {outline.toc.map((item) => (
  1. {item.text}
  2. ))}
)}
{newest && (

{t.corrections}

    {corrections.items.map((c) => (
  1. {t.correctionKind[c.kind]}

  2. ))}
)}