Add TOC and Layout components; update pages
This commit is contained in:
21
src/components/ContentTOC.astro
Normal file
21
src/components/ContentTOC.astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
const { sectionName } = Astro.props;
|
||||
|
||||
const entries = (await getCollection(sectionName)).sort((a, b) =>
|
||||
a.data.title.localeCompare(b.data.title),
|
||||
);
|
||||
|
||||
const articles = entries.filter((entry) => entry.id !== "index");
|
||||
---
|
||||
|
||||
<ul>
|
||||
{articles.map((entry) => (
|
||||
<li>
|
||||
<a href={`/${sectionName}/${entry.id}`}>
|
||||
{entry.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user