|
|
@ -1,17 +1,16 @@
|
|
|
|
---
|
|
|
|
---
|
|
|
|
const years = await Astro.glob("../pages/archivio/*/index.md");
|
|
|
|
const years = await Astro.glob('../pages/archivio/*/index.md')
|
|
|
|
const yearLabels = years.map((module) => module.file.split("/").at(-2)).toSorted();
|
|
|
|
const yearLabels = years.map(module => module.file.split('/').at(-2)).toSorted()
|
|
|
|
const currentYear = yearLabels.at(-1);
|
|
|
|
const currentYear = yearLabels.at(-1)
|
|
|
|
|
|
|
|
|
|
|
|
const { selectedCourseLabel, courses } = Astro.props;
|
|
|
|
const { selectedCourseLabel, courses } = Astro.props
|
|
|
|
const title = courses.find((module) => module.file.includes("index.md")).frontmatter
|
|
|
|
const title = courses.find(module => module.file.includes('index.md')).frontmatter.title
|
|
|
|
.title;
|
|
|
|
|
|
|
|
const selectedYear = courses
|
|
|
|
const selectedYear = courses
|
|
|
|
.find((module) => module.file.includes("index.md"))
|
|
|
|
.find(module => module.file.includes('index.md'))
|
|
|
|
.file.split("/")
|
|
|
|
.file.split('/')
|
|
|
|
.at(-2);
|
|
|
|
.at(-2)
|
|
|
|
const isCurrentYear = currentYear == selectedYear;
|
|
|
|
const isCurrentYear = currentYear == selectedYear
|
|
|
|
const coursesWithoutIndex = courses.filter((m) => !m.file.includes("index.md"));
|
|
|
|
const coursesWithoutIndex = courses.filter(m => !m.file.includes('index.md'))
|
|
|
|
---
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
<header>
|
|
|
|
<header>
|
|
|
@ -24,39 +23,31 @@ const coursesWithoutIndex = courses.filter((m) => !m.file.includes("index.md"));
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</h1>
|
|
|
|
</h1>
|
|
|
|
<nav>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<ul>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
yearLabels.slice(0, -1).map((year) => (
|
|
|
|
yearLabels.slice(0, -1).map(year => (
|
|
|
|
<li class:list={{ active: year === selectedYear }}>
|
|
|
|
<li class:list={{ active: year === selectedYear }}>
|
|
|
|
<a href={`/archivio/${year}`}>{year}</a>
|
|
|
|
<a href={`/archivio/${year}`}>{year}</a>
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
<li class:list={{ active: currentYear === selectedYear }}>
|
|
|
|
<li class:list={{ active: currentYear === selectedYear }}>
|
|
|
|
<a href={"/"}>{currentYear}</a>
|
|
|
|
<a href={'/'}>{currentYear}</a>
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
<ul>
|
|
|
|
<ul>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
coursesWithoutIndex.map((course) => (
|
|
|
|
coursesWithoutIndex.map(course => (
|
|
|
|
<li
|
|
|
|
<li
|
|
|
|
class:list={{
|
|
|
|
class:list={{
|
|
|
|
active: selectedCourseLabel === course.file.split("/").at(-1),
|
|
|
|
active: selectedCourseLabel === course.file.split('/').at(-1),
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
<a href={isCurrentYear ? '/' + course.url.split('/').at(-1) : course.url}>
|
|
|
|
href={
|
|
|
|
|
|
|
|
isCurrentYear
|
|
|
|
|
|
|
|
? "/" + course.url.split("/").at(-1)
|
|
|
|
|
|
|
|
: course.url
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{course.frontmatter.title}
|
|
|
|
{course.frontmatter.title}
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
</header>
|
|
|
|
</header>
|
|
|
|