--- const { selectedCourseLabel, courses } = Astro.props const years = await Astro.glob('../pages/archivio/*/index.md') const yearLabels = years.map(module => module.file.split('/').at(-2)).toSorted() /** Get the current year using the latest year label */ const currentYear = yearLabels.at(-1) /** Get the selected year using the courses array */ const selectedYear = courses .find(module => module.file.includes('index.md')) .file.split('/') .at(-2) const selectedYearIndex = yearLabels.indexOf(selectedYear) const previousYear = selectedYearIndex > 0 ? yearLabels[selectedYearIndex - 1] : null const nextYear = selectedYearIndex < yearLabels.length - 1 ? yearLabels[selectedYearIndex + 1] : null const isCurrentYear = currentYear == selectedYear const coursesWithoutIndex = courses.filter(m => !m.file.includes('index.md')) function yearLink(year: string) { return year === currentYear ? '/' : `/archivio/${year}` } ---

Tutorato Matematica