Website/src/pages/[...slug].astro

82 Zeilen
1.9 KiB
Plaintext

2023-10-01 10:04:04 +02:00
---
import { getCollection } from 'astro:content'
import NavbarLayout from "../layouts/NavbarLayout.astro";
2023-10-12 21:02:57 +02:00
import {astroI18n, createGetStaticPaths} from "astro-i18n";
2023-11-03 20:31:27 +01:00
import localBau from "../images/2023-10-08_20.43.43.png";
import {Image} from "astro:assets";
2023-10-01 10:04:04 +02:00
2023-11-03 20:31:27 +01:00
export const getStaticPaths = createGetStaticPaths(async () => {
2023-10-01 10:04:04 +02:00
let posts = await getCollection("pages");
2023-10-12 21:02:57 +02:00
return posts.filter(value => value.id.split("/")[0] === astroI18n.locale).map((page) => ({
2023-10-01 10:04:04 +02:00
props: { page }, params: { slug: page.slug }
}) )
2023-11-03 20:31:27 +01:00
})
2023-10-01 10:04:04 +02:00
const { page } = Astro.props;
const { Content } = await page.render();
---
<NavbarLayout title={page.data.title}>
2023-11-03 20:31:27 +01:00
<div>
<Image src={localBau} alt="Bau" width="1920" height="1080" class="w-screen h-screen dark:brightness-75 fixed -z-10 object-cover" draggable="false" />
<article>
<h1 class="text-left">{page.data.title}</h1>
<Content />
</article>
</div>
2023-10-01 10:04:04 +02:00
</NavbarLayout>
<style is:global>
article {
2023-11-03 20:31:27 +01:00
width: min(100vw, 75em);
@apply mx-auto bg-gray-100 p-8 rounded-b-md shadow-md pt-40 sm:pt-28 md:pt-14
2023-10-01 10:04:04 +02:00
dark:text-white dark:bg-neutral-900;
2023-10-12 21:02:57 +02:00
p {
@apply my-4 leading-7;
}
2023-10-01 10:04:04 +02:00
h1 {
@apply text-4xl font-bold mt-4 text-center;
}
2023-10-12 21:02:57 +02:00
2023-10-01 10:04:04 +02:00
h2 {
@apply text-3xl font-bold mt-4;
}
2023-10-12 21:02:57 +02:00
2023-10-01 10:04:04 +02:00
h3 {
@apply text-2xl font-bold mt-4;
}
2023-10-12 21:02:57 +02:00
2023-10-01 10:04:04 +02:00
h4 {
@apply text-xl font-bold mt-4;
}
a {
@apply text-blue-500 hover:text-blue-700;
}
2023-10-12 21:02:57 +02:00
ol>li, ul>li {
@apply ml-4;
}
ol {
@apply list-decimal;
}
ul {
@apply list-disc;
}
2023-11-03 20:31:27 +01:00
code {
@apply dark:text-neutral-400 text-neutral-800;
}
2023-10-01 10:04:04 +02:00
pre.astro-code {
2023-10-12 21:02:57 +02:00
@apply w-fit p-4 rounded-md border-2 border-gray-600 my-4;
2023-10-01 10:04:04 +02:00
}
}
</style>