add static site generation including robots.txt and sitemap.xml

This commit is contained in:
survellow
2024-07-03 17:33:12 +02:00
parent a003ba736c
commit cf638cf93c
31 changed files with 846 additions and 923 deletions

View File

@@ -19,6 +19,9 @@
import { Module } from "../model/module.ts";
export async function fetchCourse(): Promise<string[]> {
if (import.meta.env.SSR) {
return [];
}
const courses: string[] = [];
await fetch("/api/courses")
.then((response) => {
@@ -39,6 +42,9 @@ export async function fetchCourse(): Promise<string[]> {
export async function fetchCourseBySemester(
semester: string,
): Promise<string[]> {
if (import.meta.env.SSR) {
return [];
}
const courses: string[] = [];
await fetch("/api/courses/events?semester=" + semester)
.then((response) => {
@@ -60,6 +66,9 @@ export async function fetchModulesByCourseAndSemester(
course: string,
semester: string,
): Promise<Module[]> {
if (import.meta.env.SSR) {
return [];
}
const modules: Module[] = [];
await fetch("/api/course/modules?course=" + course + "&semester=" + semester)
.then((response) => {
@@ -86,6 +95,9 @@ export async function fetchModulesByCourseAndSemester(
}
export async function fetchAllModules(): Promise<Module[]> {
if (import.meta.env.SSR) {
return [];
}
const modules: Module[] = [];
await fetch("/api/modules")
.then((response) => {