--- import { Image } from 'astro:assets'; import { getEntry } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; import FormattedDate from '~/components/FormattedDate.astro'; import Webmentions from '~/components/Webmentions.astro'; import BaseLayout from '~/layouts/BaseLayout.astro'; import { DEFAULT_LOCALE, type Locale } from '~/consts'; import { categoryHref, entryHref, entrySlug, findTranslation, getSeries, postHref, 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, hideHero, category, tags, url, repo, 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; const series = entry ? await getSeries(entry) : undefined; const currentSlug = entry ? entrySlug(entry) : undefined; const seriesPosition = series && currentSlug ? series.entries.findIndex((e) => entrySlug(e) === currentSlug) : -1; ---
{ heroImage && !hideHero && ( ) }
{ 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}))}

) } { (url || repo) && ( ) }
{ series && seriesPosition >= 0 && ( ) } { translation && ( ) }