forked from phc/tutorato
add drone
parent
a573218bec
commit
4ac5d9b2e3
@ -0,0 +1,46 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: deploy
|
||||
image: node:latest
|
||||
volumes:
|
||||
- name: host-tutorato-dist
|
||||
path: /drone/src/dist
|
||||
environment:
|
||||
BASE_URL:
|
||||
from_secret: base_url
|
||||
commands:
|
||||
- pwd
|
||||
- npm install
|
||||
- npm run build
|
||||
|
||||
volumes:
|
||||
- name: host-tutorato-dist
|
||||
host:
|
||||
path: /var/www/tutorato
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: exec
|
||||
name: caddy-permissions
|
||||
|
||||
depends_on:
|
||||
- default
|
||||
|
||||
steps:
|
||||
- name: chown
|
||||
commands:
|
||||
- chown -R caddy:caddy /var/www/tutorato
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
@ -1,53 +1,55 @@
|
||||
---
|
||||
const years = await Astro.glob('../pages/archivio/*/index.md')
|
||||
const yearLabels = years.map(module => module.file.split('/').at(-2)).toSorted()
|
||||
const currentYear = yearLabels.at(-1)
|
||||
const years = await Astro.glob("../pages/archivio/*/index.md");
|
||||
const yearLabels = years.map((module) => module.file.split("/").at(-2)).toSorted();
|
||||
const currentYear = yearLabels.at(-1);
|
||||
|
||||
const { selectedCourseLabel, courses } = Astro.props
|
||||
const title = courses.find(module => module.file.includes('index.md')).frontmatter.title
|
||||
const { selectedCourseLabel, courses } = Astro.props;
|
||||
const selectedYear = courses
|
||||
.find(module => module.file.includes('index.md'))
|
||||
.file.split('/')
|
||||
.at(-2)
|
||||
const isCurrentYear = currentYear == selectedYear
|
||||
const coursesWithoutIndex = courses.filter(m => !m.file.includes('index.md'))
|
||||
.find((module) => module.file.includes("index.md"))
|
||||
.file.split("/")
|
||||
.at(-2);
|
||||
const isCurrentYear = currentYear == selectedYear;
|
||||
const coursesWithoutIndex = courses.filter((m) => !m.file.includes("index.md"));
|
||||
---
|
||||
|
||||
<header>
|
||||
<h1>
|
||||
{
|
||||
isCurrentYear ? (
|
||||
<a href="/">{title}</a>
|
||||
) : (
|
||||
<a href={`/archivio/${selectedYear}`}>{title}</a>
|
||||
)
|
||||
}
|
||||
</h1>
|
||||
<ul>
|
||||
{
|
||||
yearLabels.slice(0, -1).map(year => (
|
||||
<li class:list={{ active: year === selectedYear }}>
|
||||
<a href={`/archivio/${year}`}>{year}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
<li class:list={{ active: currentYear === selectedYear }}>
|
||||
<a href={'/'}>{currentYear}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
{
|
||||
coursesWithoutIndex.map(course => (
|
||||
<li
|
||||
class:list={{
|
||||
active: selectedCourseLabel === course.file.split('/').at(-1),
|
||||
}}
|
||||
>
|
||||
<a href={isCurrentYear ? '/' + course.url.split('/').at(-1) : course.url}>
|
||||
{course.frontmatter.title}
|
||||
</a>
|
||||
<a href="/"> Tutorato Matematica</a>
|
||||
<nav>
|
||||
<ul>
|
||||
{
|
||||
yearLabels.slice(0, -1).map((year) => (
|
||||
<li class:list={{ active: year === selectedYear }}>
|
||||
<a href={`/archivio/${year}`}>{year}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
<li class:list={{ active: currentYear === selectedYear }}>
|
||||
<a href={"/"}>{currentYear}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</ul>
|
||||
<ul>
|
||||
{
|
||||
coursesWithoutIndex.map((course) => (
|
||||
<li
|
||||
class:list={{
|
||||
active:
|
||||
selectedCourseLabel === course.file.split("/").at(-1),
|
||||
}}
|
||||
>
|
||||
<a
|
||||
href={
|
||||
isCurrentYear
|
||||
? "/" + course.url.split("/").at(-1)
|
||||
: course.url
|
||||
}
|
||||
>
|
||||
{course.frontmatter.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</nav>
|
||||
</h1>
|
||||
</header>
|
||||
|
Loading…
Reference in New Issue