diff --git a/Dockerfile b/Dockerfile index 5ab6108..4c19ea5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ RUN npm run build FROM nginx:1.29-alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..46c6301 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location ~ "^/([0-9]{4})/?$" { + return 302 "/?year=$1#events"; + } + + location / { + try_files $uri $uri/ =404; + } +} diff --git a/src/pages/[year]/index.astro b/src/pages/[year]/index.astro new file mode 100644 index 0000000..5c13715 --- /dev/null +++ b/src/pages/[year]/index.astro @@ -0,0 +1,36 @@ +--- +import { organizedEvents } from "../../data/events"; + +export function getStaticPaths() { + const years = Array.from(new Set(organizedEvents.map((event) => event.year))); + + return years.map((year) => ({ + params: { year }, + props: { year }, + })); +} + +type Props = { + year: string; +}; + +const { year } = Astro.props; +const target = `/?year=${encodeURIComponent(year)}#events`; +--- + + + + + + + + + Redirecting to {year} events + + + +

Redirecting to {year} events.

+ +