--- import { Image } from 'astro:assets'; import { getEntry } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; import FormattedDate from '~/components/FormattedDate.astro'; import BaseLayout from '~/layouts/BaseLayout.astro'; import { DEFAULT_LOCALE, type Locale } from '~/consts'; import { categoryHref, entryHref, findTranslation, tagHref } from '~/i18n/posts'; import { getLocaleFromUrl, t } from '~/i18n/ui'; type Props = CollectionEntry<'posts'>['data'] & { locale?: Locale; entry?: CollectionEntry<'posts'>; }; const { title, description, pubDate, updatedDate, heroImage, category, tags, entry, locale = getLocaleFromUrl(Astro.url) ?? DEFAULT_LOCALE, } = Astro.props; const categoryEntry = category ? await getEntry(category) : undefined; const otherLocale: Locale = locale === 'de' ? 'en' : 'de'; const translation = entry ? await findTranslation(entry, otherLocale) : undefined; ---
{ heroImage && ( ) }
{ updatedDate && (
{t(locale, 'post.lastUpdated')}
) }

{title}

{ categoryEntry && (

{t(locale, 'post.category')}:{' '} {categoryEntry.data.name}

) } { tags && tags.length > 0 && (

{t(locale, 'post.tags')}:{' '} {tags.map((name, i) => ( <> {i > 0 && ', '} {name} ))}

) }
{ translation && ( ) }