P Primer · 07

Topic index

주제 목록

sections gives each topic a box with a grey header row and post titles stacked as blue links. index shows only topic rows, and lead drops the boxes and shows the first post large.

RuleThe featured post is not repeated here, so no post appears twice on the home page. The “finder” hero and the “index” list hold the same links, so they are never picked together.

Also known as: TopicIndex
···
usage (Astro)
---
// src/pages/index.astro
import { TopicIndex } from '../components/registry';
---
<TopicIndex heading="주제별로 보기" topics={await topics(featured)} />
site.json
// sites/<사이트>/site.json — 적지 않으면 사이트 이름으로 자동으로 고른다
{
  "variants": { "TopicIndex": "sections" }
}
props (TypeScript)
export interface TopicIndexProps {
  heading: string;
  topics: Topic[];
  variant?: VariantOf<'TopicIndex'>;
}

sections gives each topic a box with a header row (name and count), a description, three posts and a “All n posts” footer row, standing side by side in two columns on wide screens. index is a single box of topic rows showing only name, description and count, no post list. lead drops the boxes: each topic gets a name with a line under it, then the first post in large type (with description) and two more as small links.

To show posts right on the home page choose sections; to keep the home short with topic shortcuts only, index. Many boxes can feel dense, and lead breathes the most. Column count is chosen so no lone box is left on the last row (4 topics make 2×2, 3 or 6 make three columns).

The featured post is passed in separately, so the same post is not shown twice.

Use it when — Variants 3

  1. sectionsSections When every topic has three or more posts.Used by 4: babyplay, babysleep, birthprep, newborn
  2. indexIndex When there are many topics and posts should be browsed on topic pages — name, blurb and count only.Used by 4: babyfood, feeding, milestone, vaccination
  3. leadLead When each topic has a clear lead post — one big, two small.Used by 3: babysick, toddlerfood, 허브
Open as page ↗

Suggest an entry

Tell us about a missing component or variant, or something a pack should fix. We read every suggestion.