--- import {astroI18n, createGetStaticPaths} from "astro-i18n"; import {getCollection, CollectionEntry} from "astro:content"; import PageLayout from "@layouts/PageLayout.astro"; import {TagSolid, CalendarMonthSolid} from "flowbite-svelte-icons"; import TagComponent from "@components/TagComponent.astro"; import LanguageWarning from "@components/LanguageWarning.astro"; import {SEO} from "astro-seo"; import localBau from "@images/2022-03-28_13.18.25.png"; import {getImage, Image} from "astro:assets"; import "@styles/table.css"; export const getStaticPaths = createGetStaticPaths(async () => { const posts = await getCollection("announcements", entry => entry.id.split("/")[0] === astroI18n.locale); const germanPosts = await getCollection("announcements", entry => entry.id.split("/")[0] === astroI18n.fallbackLocale); germanPosts.forEach(value => { if (posts.find(post => post.data.key === value.data.key)) { return; } else { posts.push(value); } }); return posts.map(value => ({ params: { slug: value.slug.split("/").slice(1).join("/"), }, props: { post: value, german: value.id.split("/")[0] != astroI18n.locale, }, })); }); interface Props { post: CollectionEntry<"announcements">, german: boolean } const {post, german} = Astro.props; const {Content} = await post.render(); const ogImage = await getImage({ src: post.data.image || localBau, format: "png", width: 1200, height: 630, }); ---
{post.data.image && (
)}

{post.data.title}

{post.data.tags.map(tag => ( ))}
{Intl.DateTimeFormat(astroI18n.locale, { day: "numeric", month: "short", year: "numeric", }).format(post.data.created)} {post.data.author && ( {post.data.author} {post.data.author} )}
{german && ( )}