--- import { getCollection } from 'astro:content'; import Base from '../../layouts/Base.astro'; import PostCard from '../../components/PostCard.astro'; import { CATEGORY_LABELS, SITE_NAME } from '../../lib'; const posts = (await getCollection('posts')).sort((a, b) => b.data.dateModified.localeCompare(a.data.dateModified)); const cats = Object.keys(CATEGORY_LABELS); const site = Astro.site!.toString().replace(/\/$/, ''); const ld = { '@type': 'CollectionPage', '@id': `${site}/posts#page`, name: '전체 글', url: `${site}/posts`, inLanguage: 'ko', publisher: { '@type': 'Organization', name: SITE_NAME, url: site }, hasPart: posts.map((p) => ({ '@type': 'Article', headline: p.data.title, url: `${site}/posts/${p.id}`, dateModified: p.data.dateModified })) }; ---
전체 글

질문별로 답한 글

궁금한 주제를 골라 보세요. 글 하나가 질문 하나에 답합니다.

{cats.map((c) => { const list = posts.filter((p) => p.data.category === c); if (!list.length) return null; return (

{c}. {CATEGORY_LABELS[c]}

{list.length}편
{list.map((p) => )}
); })}