Skip to content
ui8kit

block / content

Post Header

Category, title, excerpt, author line and a wide cover.

Install

npx ui8kit add post-header

Pulls in: compose, empty-state, group, kit-box, kit-text, media-frame, pill, post-card, section-frame, text, utils

Preview

Why static-first pages still win

Less script, less waiting, and pages that keep working offline.

Mar 18, 2026

6 min read

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add post-header
blocks/post-header.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout
  (start, center), cover (show, hide), meta (full, short), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Post, PostLabels } from "./post-card.types";

  export type PostHeaderProps = {
    id: string;
    post?: Post;
    labels: PostLabels;
    level?: 1 | 2;
    layout?: "start" | "center";
    cover?: "show" | "hide";
    meta?: "full" | "short";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Group from "../compose/Group.svelte";
  import Text from "../compose/Text.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import Pill from "../components/pill.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { tpl } from "../utils";

  let {
    id,
    post,
    labels,
    level = 1,
    layout = "start",
    cover = "show",
    meta = "full",
    tone = "default",
    landmarkLabel,
  }: PostHeaderProps = $props();
</script>

{#if post}
  <SectionFrame
    id={id}
    title={post?.title}
    lead={post?.excerpt}
    heading={{ level }}
    align={layout}
    tone={tone}
    media={{ show: ((cover as string) === "show") }}
    landmarkLabel={landmarkLabel}
  >
    <Group
      gap="4"
      align="center"
      justify={(((layout as string) === "center") ? "center" : "start")}
      class="flex-wrap"
      data-slot="post-meta"
    >
      <MediaFrame alt={post?.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
      <Text size="sm" weight="semibold">
        {post?.author}
      </Text>
      <Text size="sm" class="text-muted-foreground">
        {post?.date}
      </Text>
      {#if ((meta as string) === "full")}
        <Text size="sm" class="text-muted-foreground">
          {tpl(labels.minutes, post?.minutes)}
        </Text>
      {/if}
      <Pill tone="blue">
        {post?.category}
      </Pill>
    </Group>
    {#snippet aside()}
      <MediaFrame alt={post?.title} src={post?.image} ratio="21/9" />
    {/snippet}
  </SectionFrame>
{:else}
  <SectionFrame id={id} heading={{ level }} align={layout} tone={tone} landmarkLabel={landmarkLabel}>
    <EmptyState icon="file-text" title={labels.empty} />
  </SectionFrame>
{/if}

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add post-header
blocks/post-header.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout
 * (start, center), cover (show, hide), meta (full, short), tone.
 */
import { type ReactNode } from "react";
import { Group, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { Pill } from "../components/pill";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Post, PostLabels } from "./post-card.types";

export type PostHeaderProps = {
  id: string;
  post?: Post;
  labels: PostLabels;
  level?: 1 | 2;
  layout?: "start" | "center";
  cover?: "show" | "hide";
  meta?: "full" | "short";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function PostHeader({
  id,
  post,
  labels,
  level = 1,
  layout = "start",
  cover = "show",
  meta = "full",
  tone = "default",
  landmarkLabel,
}: PostHeaderProps) {
  return (
    <>
      {post ? (
        <SectionFrame
          id={id}
          title={post?.title}
          lead={post?.excerpt}
          heading={{ level }}
          align={layout}
          tone={tone}
          media={{ show: ((cover as string) === "show") }}
          landmarkLabel={landmarkLabel}
          aside={(
            <MediaFrame alt={post?.title} src={post?.image} ratio="21/9" />
          )}
        >
          <Group
            gap="4"
            align="center"
            justify={(((layout as string) === "center") ? "center" : "start")}
            className="flex-wrap"
            data-slot="post-meta"
          >
            <MediaFrame alt={post?.author} ratio="1/1" className="size-10 shrink-0 rounded-full" />
            <Text size="sm" weight="semibold">
              {post?.author}
            </Text>
            <Text size="sm" className="text-muted-foreground">
              {post?.date}
            </Text>
            {((meta as string) === "full") ? (
              <Text size="sm" className="text-muted-foreground">
                {tpl(labels.minutes, post?.minutes)}
              </Text>
            ) : null}
            <Pill tone="blue">
              {post?.category}
            </Pill>
          </Group>
        </SectionFrame>
      ) : (
        <SectionFrame id={id} heading={{ level }} align={layout} tone={tone} landmarkLabel={landmarkLabel}>
          <EmptyState icon="file-text" title={labels.empty} />
        </SectionFrame>
      )}
    </>
  );
}

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add post-header
blocks/post-header.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout
  (start, center), cover (show, hide), meta (full, short), tone.
-->
<script lang="ts">
import type { Post, PostLabels } from "./post-card.types";

export type PostHeaderProps = {
  id: string;
  post?: Post;
  labels: PostLabels;
  level?: 1 | 2;
  layout?: "start" | "center";
  cover?: "show" | "hide";
  meta?: "full" | "short";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Group from "../compose/Group.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import Pill from "../components/pill.vue";
import SectionFrame from "../components/section-frame.vue";
import { tpl } from "../utils";

const {
  id,
  post,
  labels,
  level = 1,
  layout = "start",
  cover = "show",
  meta = "full",
  tone = "default",
  landmarkLabel,
} = defineProps<PostHeaderProps>();
</script>

<template>
  <SectionFrame v-if="post"
    :id="id"
    :title="post?.title"
    :lead="post?.excerpt"
    :heading="{ level }"
    :align="layout"
    :tone="tone"
    :media="{ show: ((cover as string) === 'show') }"
    :landmarkLabel="landmarkLabel"
  >
    <Group
      gap="4"
      align="center"
      :justify="(((layout as string) === 'center') ? 'center' : 'start')"
      class="flex-wrap"
      data-slot="post-meta"
    >
      <MediaFrame :alt="post?.author" ratio="1/1" class="size-10 shrink-0 rounded-full" />
      <Text size="sm" weight="semibold">
        {{ post?.author }}
      </Text>
      <Text size="sm" class="text-muted-foreground">
        {{ post?.date }}
      </Text>
      <Text v-if="((meta as string) === 'full')" size="sm" class="text-muted-foreground">
        {{ tpl(labels.minutes, post?.minutes) }}
      </Text>
      <Pill tone="blue">
        {{ post?.category }}
      </Pill>
    </Group>
    <template #aside>
      <MediaFrame :alt="post?.title" :src="post?.image" ratio="21/9" />
    </template>
  </SectionFrame>
  <SectionFrame
    v-else
    :id="id"
    :heading="{ level }"
    :align="layout"
    :tone="tone"
    :landmarkLabel="landmarkLabel"
  >
    <EmptyState icon="file-text" :title="labels.empty" />
  </SectionFrame>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add post-header
blocks/post-header.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout
 * (start, center), cover (show, hide), meta (full, short), tone.
 */
import { type JSX } from "solid-js";
import { Group, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { Pill } from "../components/pill";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Post, PostLabels } from "./post-card.types";

export type PostHeaderProps = {
  id: string;
  post?: Post;
  labels: PostLabels;
  level?: 1 | 2;
  layout?: "start" | "center";
  cover?: "show" | "hide";
  meta?: "full" | "short";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function PostHeader({
  id,
  post,
  labels,
  level = 1,
  layout = "start",
  cover = "show",
  meta = "full",
  tone = "default",
  landmarkLabel,
}: PostHeaderProps) {
  return (
    <>
      {post ? (
        <SectionFrame
          id={id}
          title={post?.title}
          lead={post?.excerpt}
          heading={{ level }}
          align={layout}
          tone={tone}
          media={{ show: ((cover as string) === "show") }}
          landmarkLabel={landmarkLabel}
          aside={(
            <MediaFrame alt={post?.title} src={post?.image} ratio="21/9" />
          )}
        >
          <Group
            gap="4"
            align="center"
            justify={(((layout as string) === "center") ? "center" : "start")}
            class="flex-wrap"
            data-slot="post-meta"
          >
            <MediaFrame alt={post?.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
            <Text size="sm" weight="semibold">
              {post?.author}
            </Text>
            <Text size="sm" class="text-muted-foreground">
              {post?.date}
            </Text>
            {((meta as string) === "full") ? (
              <Text size="sm" class="text-muted-foreground">
                {tpl(labels.minutes, post?.minutes)}
              </Text>
            ) : null}
            <Pill tone="blue">
              {post?.category}
            </Pill>
          </Group>
        </SectionFrame>
      ) : (
        <SectionFrame id={id} heading={{ level }} align={layout} tone={tone} landmarkLabel={landmarkLabel}>
          <EmptyState icon="file-text" title={labels.empty} />
        </SectionFrame>
      )}
    </>
  );
}

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add post-header
blocks/post-header.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/post-header.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// PostHeaderProps are the props of PostHeader; the values are the JSON shapes of the TypeScript props.
type PostHeaderProps struct {
	Id any `json:"id"`
	Post any `json:"post"`
	Labels any `json:"labels"`
	Level any `json:"level"`
	Layout any `json:"layout"`
	Cover any `json:"cover"`
	Meta any `json:"meta"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout (start, center), cover (show, hide), meta (full, short), tone.
templ PostHeader(p PostHeaderProps) {
	{{ vId := p.Id }}
	{{ vPost := p.Post }}
	{{ vLabels := p.Labels }}
	{{ vLevel := uiutils.Def(p.Level, float64(1)) }}
	{{ vLayout := uiutils.Def(p.Layout, "start") }}
	{{ vCover := uiutils.Def(p.Cover, "show") }}
	{{ vMeta := uiutils.Def(p.Meta, "full") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	if uiutils.T(vPost) {
		@SectionFrame(SectionFrameProps{Id: vId, Title: uiutils.Get(vPost, "title"), Lead: uiutils.Get(vPost, "excerpt"), Heading: map[string]any{"level": vLevel}, Align: vLayout, Tone: vTone, Media: map[string]any{"show": uiutils.Eq(vCover, "show")}, LandmarkLabel: vLandmarkLabel, Aside: postHeaderFill1(p, vPost)}) {
			@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "center")), "center", "start")), BoxProps: box.BoxProps{Class: "flex-wrap", Attrs: uiutils.Attrs("data-slot", "post-meta")}}) {
				@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vPost, "author"), Ratio: "1/1", Class: uiutils.Cnv("size-10 shrink-0 rounded-full")})
				@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Get(vPost, "author")) }
				}
				@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
					{ uiutils.Text(uiutils.Get(vPost, "date")) }
				}
				if uiutils.Eq(vMeta, "full") {
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "minutes"), uiutils.Get(vPost, "minutes"))) }
					}
				}
				@Pill(PillProps{Tone: "blue"}) {
					{ uiutils.Text(uiutils.Get(vPost, "category")) }
				}
			}
		}
	} else {
		@SectionFrame(SectionFrameProps{Id: vId, Heading: map[string]any{"level": vLevel}, Align: vLayout, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
			@EmptyState(EmptyStateProps{Icon: "file-text", Title: uiutils.Get(vLabels, "empty")})
		}
	}
}

templ postHeaderFill1(p PostHeaderProps, vPost any) {
	@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vPost, "title"), Src: uiutils.Get(vPost, "image"), Ratio: "21/9"})
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add post-header
blocks/post-header.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-header.json
    The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout (start, center), cover (show, hide), meta (full, short), tone.
    Props (p): id, post, labels, level, layout, cover, meta, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_post = (p.post ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_level = (p.level ?? 1) -%}
{%- set v_layout = (p.layout ?? 'start') -%}
{%- set v_cover = (p.cover ?? 'show') -%}
{%- set v_meta = (p.meta ?? 'full') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- if og_t(v_post) %}
  {%- set f_6 -%}
    {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'ratio': '21/9'}}, with_context = false) }}
  {%- endset -%}
  {%- set c_7 -%}
    {%- set c_5 -%}
      {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_post, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}, with_context = false) }}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['author'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
      {%- set c_2 -%}
        {{ og_text(og_get(v_post, ['date'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
      {%- if og_t(og_eq(v_meta, 'full')) %}
        {%- set c_3 -%}
          {{ og_text(og_tpl(og_get(v_labels, ['minutes']), [og_get(v_post, ['minutes'])])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
      {%- endif %}
      {%- set c_4 -%}
        {{ og_text(og_get(v_post, ['category'])) }}
      {%- endset -%}
      {{ include('blocks/pill.html.twig', {'p': {'tone': 'blue'}, 'children': og_markup(c_4)}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': og_s((og_t(og_eq(v_layout, 'center')) ? 'center' : 'start')), 'class': 'flex-wrap', 'attrs': og_attrs(['data-slot', 'post-meta']), 'children': c_5}, with_context = false) }}
  {%- endset -%}
  {{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': og_get(v_post, ['title']), 'lead': og_get(v_post, ['excerpt']), 'heading': {'level': v_level}, 'align': v_layout, 'tone': v_tone, 'media': {'show': og_eq(v_cover, 'show')}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_6)}, 'children': og_markup(c_7)}, with_context = false) }}
{%- else %}
  {%- set c_8 -%}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'file-text', 'title': og_get(v_labels, ['empty'])}}, with_context = false) }}
  {%- endset -%}
  {{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'heading': {'level': v_level}, 'align': v_layout, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_8)}, with_context = false) }}
{%- endif %}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add post-header
blocks/post-header.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-header.json
    The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout (start, center), cover (show, hide), meta (full, short), tone.
    Props (p): id, post, labels, level, layout, cover, meta, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_post = ($p['post'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_level = ($p['level'] ?? 1)}
{var $v_layout = ($p['layout'] ?? 'start')}
{var $v_cover = ($p['cover'] ?? 'show')}
{var $v_meta = ($p['meta'] ?? 'full')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{if og_t($v_post)}
  {capture $f_6}
    {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_post, ['title']), 'src' => og_get($v_post, ['image']), 'ratio' => '21/9']])|noescape}
  {/capture}
  {capture $c_7}
    {capture $c_5}
      {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_post, ['author']), 'ratio' => '1/1', 'className' => og_cnv(['size-10 shrink-0 rounded-full'])]])|noescape}
      {capture $c_1}
        {=og_text(og_get($v_post, ['author']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
      {capture $c_2}
        {=og_text(og_get($v_post, ['date']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
      {if og_t(og_eq($v_meta, 'full'))}
        {capture $c_3}
          {=og_text(og_tpl(og_get($v_labels, ['minutes']), [og_get($v_post, ['minutes'])]))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
      {/if}
      {capture $c_4}
        {=og_text(og_get($v_post, ['category']))}
      {/capture}
      {=og_include('blocks/pill.latte', ['p' => ['tone' => 'blue'], 'children' => og_markup($c_4)])|noescape}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => og_s((og_t(og_eq($v_layout, 'center')) ? 'center' : 'start')), 'class' => 'flex-wrap', 'attrs' => og_attrs(['data-slot', 'post-meta']), 'children' => (string) $c_5])|noescape}
  {/capture}
  {=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => og_get($v_post, ['title']), 'lead' => og_get($v_post, ['excerpt']), 'heading' => ['level' => $v_level], 'align' => $v_layout, 'tone' => $v_tone, 'media' => ['show' => og_eq($v_cover, 'show')], 'landmarkLabel' => $v_landmarkLabel, 'aside' => og_markup($f_6)], 'children' => og_markup($c_7)])|noescape}
{else}
  {capture $c_8}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'file-text', 'title' => og_get($v_labels, ['empty'])]])|noescape}
  {/capture}
  {=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'heading' => ['level' => $v_level], 'align' => $v_layout, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_8)])|noescape}
{/if}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add post-header
blocks/post-header.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-header.json
    The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout (start, center), cover (show, hide), meta (full, short), tone.
    Props (p): id, post, labels, level, layout, cover, meta, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_post = og_def(p['post'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_level = og_def(p['level'], 1) -%}
{%- set v_layout = og_def(p['layout'], 'start') -%}
{%- set v_cover = og_def(p['cover'], 'show') -%}
{%- set v_meta = og_def(p['meta'], 'full') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- if og_t(v_post) %}
  {%- set f_6 -%}
    {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'ratio': '21/9'}}) }}
  {%- endset -%}
  {%- set c_7 -%}
    {%- set c_5 -%}
      {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_post, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}) }}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['author'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
      {%- set c_2 -%}
        {{ og_text(og_get(v_post, ['date'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
      {%- if og_t(og_eq(v_meta, 'full')) %}
        {%- set c_3 -%}
          {{ og_text(og_tpl(og_get(v_labels, ['minutes']), [og_get(v_post, ['minutes'])])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
      {%- endif %}
      {%- set c_4 -%}
        {{ og_text(og_get(v_post, ['category'])) }}
      {%- endset -%}
      {{ og_include('blocks/pill.html.j2', {'p': {'tone': 'blue'}, 'children': og_markup(c_4)}) }}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': og_s(('center' if og_t(og_eq(v_layout, 'center')) else 'start')), 'Class': 'flex-wrap', 'Attrs': og_attrs(['data-slot', 'post-meta'])}, 'children': c_5}) }}
  {%- endset -%}
  {{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': og_get(v_post, ['title']), 'lead': og_get(v_post, ['excerpt']), 'heading': {'level': v_level}, 'align': v_layout, 'tone': v_tone, 'media': {'show': og_eq(v_cover, 'show')}, 'landmarkLabel': v_landmarkLabel, 'aside': og_markup(f_6)}, 'children': og_markup(c_7)}) }}
{%- else %}
  {%- set c_8 -%}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'file-text', 'title': og_get(v_labels, ['empty'])}}) }}
  {%- endset -%}
  {{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'heading': {'level': v_level}, 'align': v_layout, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_8)}) }}
{%- endif %}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

The top of a post page: category, title, excerpt, the author line and an optional wide cover. Axes: layout (start, center), cover (show, hide), meta (full, short), tone.

Props of PostHeader
PropTypeDefault Description
id (required)string-
post Post-the post; without one: the empty state
labels (required)PostLabels-
level 1 | 21
layout "start" | "center""start"
cover "show" | "hide""show"
meta "full" | "short""full"
tone "default" | "muted""default"
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one