--- // Import section components import MainLayout from "../../layouts/MainLayout.astro"; import AvatarBlogLarge from "../../components/ui/avatars/AvatarBlogLarge.astro"; import CardRelated from "../../components/ui/cards/CardRelated.astro"; import { Image } from "astro:assets"; import { capitalize, formatDate } from "../../utils"; import { getCollection } from "astro:content"; import type { CollectionEntry } from "astro:content"; export async function getStaticPaths() { const blogPosts = await getCollection("blog"); return blogPosts.map((post) => ({ params: { slug: post.slug }, props: { post }, })); } const { post } = Astro.props; const blogPosts: CollectionEntry<"blog">[] = await getCollection("blog"); const relatedPosts: CollectionEntry<"blog"> = blogPosts.filter( (blogEntry) => blogEntry.slug !== post.slug, ); ---
{post.data.author}
  • {formatDate(post.data.pubDate)}
  • {post.data.readTime} min read

{post.data.title}

{ post.data.contents.map((content: string, index: any) => index === 1 ? (

{content}

{post.data.cardImageAlt} ) : (

{content}

), ) }
{ post.data.tags?.map((tag: string) => ( {capitalize(tag)} )) }

Related articles

{relatedPosts.map((entry) => )}