---
import Date from "@components/organisms/Date.astro";
import KeywordsList from "@components/organisms/KeywordsList.astro";
import {
getFirstUserID,
getLastUpdate,
getTranslationOriginal,
isMicro,
isTranslation,
} from "@lib/collection/helpers";
import type { CollectionEntry } from "astro:content";
interface Props {
posts: CollectionEntry<"blog">[];
small?: boolean;
dateOptions?: Intl.DateTimeFormatOptions;
}
const {
posts,
small = false,
dateOptions = { year: "numeric", month: "long", day: "numeric" },
} = Astro.props;
---
{
await Promise.all(
posts.map(
async (post) => {
const { id, data } = post;
const { title, lang } = data;
const description = isMicro(post)
? post.rendered?.html
: ("description" in data ? data.description : undefined);
const keywords = isTranslation(post)
? await getTranslationOriginal(post).then((x) =>
x?.data?.keywords
)
: ("keywords" in data ? data.keywords : undefined);
const { name, email, entity } = await getFirstUserID(post);
const display = name ?? email ?? entity;
return (
-
{
description && (
{
isMicro(post)
?
: description.split("\n\n").map((
paragraph,
) =>
{paragraph}
)
}
)
}
);
},
),
)
}