---
import type { CollectionEntry } from 'astro:content';
import { render } from 'astro:content';
import Base from '@layouts/Base.astro';
import Header from '@compontents/layout/PostHeader/index.astro';
import { getBreadcrumbs } from '@lib/utils/paths';
import { toMilitaryDTG } from '@lib/utils/date';
import { extractSidenotes } from '@lib/utils/extractors';
import Sidenote from '@compontents/content/Sidenote.astro';
interface Props {
entry: CollectionEntry<'articles'> | CollectionEntry<'elements'> | CollectionEntry<'kindred'>;
collectionName: string;
}
const { entry, collectionName } = Astro.props;
const { Content } = await render(entry);
const { title, summary, subtitle, updateDate, publishDate, tags, seo } =
entry.data;
const sidenotes = entry.body ? extractSidenotes(entry.body) : [];
const hasMargin = Astro.slots.has('margin') || !!sidenotes;
const breadcrumbs = await getBreadcrumbs(
entry.data.parent ?? null,
collectionName,
);
const formattedPublishDate = toMilitaryDTG(publishDate);
const formattedUpdateDate = updateDate
? toMilitaryDTG(updateDate)
: formattedPublishDate;
const rawCover = entry.data.cover;
const headerCover =
rawCover?.src && rawCover?.showInHeader
? {
src: rawCover.src,
alt: rawCover.alt ?? '',
caption: rawCover.caption ?? '',
showInHeader: rawCover.showInHeader,
}
: undefined;
---
{hasMargin &&(
)}