--- // Import necessary components and utilities import MainLayout from "@/layouts/MainLayout.astro"; import AvatarBlogLarge from "@components/ui/avatars/AvatarBlogLarge.astro"; import CardRelated from "@components/ui/cards/CardRelated.astro"; import Bookmark from "@components/ui/buttons/Bookmark.astro"; import SocialShare from "@components/ui/buttons/SocialShare.astro"; import PostFeedback from "@components/ui/feedback/PostFeedback.astro"; import { Image } from "astro:assets"; import { capitalize, formatDate } from "@utils/utils"; import { getCollection } from "astro:content"; import type { CollectionEntry } from "astro:content"; import { SITE } from "@data/constants"; // Update getStaticPaths for French posts export async function getStaticPaths() { const blogPosts = await getCollection("blog", ({ id }) => id.startsWith("fr/") ); return blogPosts.map((post) => { const slugWithoutLang = post.slug.replace(/^fr\//, ""); // Remove the "fr/" prefix return { params: { lang: "fr", slug: slugWithoutLang }, props: { post }, }; }); } const { post } = Astro.props; // Fetch related posts const blogPosts: CollectionEntry<"blog">[] = await getCollection( "blog", ({ id }) => id.startsWith("fr/") ); const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter( (blogEntry) => blogEntry.slug !== post.slug ); const pageTitle: string = `${post.data.title} | ${SITE.title}`; ---
{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, index) => ( {capitalize(tag)} )) }

Articles connexes

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