You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
839 B

---
const allFicChapters = await Astro.glob(`../pages/fanfic/**/*.md*`);
const sortedChapters = allFicChapters
.filter(v => v.file.includes(Astro.props.name + "/"))
.map((item) => Object.assign({}, item.frontmatter, { url: item.url }))
//@ts-expect-error cease this bitch crying, what do you mean i shouldn't implicitly convert Dates to Numbers
.sort((a, b) => new Date(b.pubDate) - new Date(a.pubDate));
let i = 1
---
<div>
{
sortedChapters.map((chapter) => (
<a href={chapter.url}>
<div
class="main-content"
style="margin-bottom: 10px; font-size: 125%;"
>
<b>Chapter {i++} - {chapter.title}</b>
<i>{chapter.pubDate}</i>
</div>
</a>
))
}
</div>