--- import { getCollection } from 'astro:content'; import Base from '../../layouts/Base.astro'; import PostCard from '../../components/PostCard.astro'; import { CATEGORY_LABELS, SITE_NAME, fact, v, isPublishable } from '../../lib'; const posts = (await getCollection('posts')).filter(isPublishable).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 })) }; ---
Archive

All Answers

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

{!posts.length &&

아직 발행한 글이 없습니다. 검토를 마친 글부터 차례로 올립니다.

}
{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) => )}
); })}