fix-related-cards: adds property for other languages

This commit is contained in:
Lorenzo Tomas Diez 2024-06-06 00:23:49 -03:00
parent e0999ad21d
commit e4e2f088be
2 changed files with 4 additions and 3 deletions

View file

@ -4,16 +4,17 @@ import { Image } from "astro:assets";
import { formatDate } from "@utils/utils";
import type { CollectionEntry } from "astro:content";
const { blogEntry } = Astro.props;
const { blogEntry, recentBlogLocale = "" } = Astro.props;
interface Props {
blogEntry: CollectionEntry<"blog">;
recentBlogLocale?: string;
}
---
<a
class="group block rounded-xl outline-none ring-zinc-500 transition duration-300 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none"
href={`/blog/${blogEntry.slug}/`}
href={recentBlogLocale !== "" ? `/${recentBlogLocale}/blog/${blogEntry.slug}/` : `/blog/${blogEntry.slug}/`}
data-astro-prefetch
>
<div>

View file

@ -159,7 +159,7 @@ const pageTitle: string = `${post.data.title} | ${SITE.title}`;
</div>
<div class="grid grid-cols-2 gap-6">
{relatedPosts.map((entry) => <CardRelated blogEntry={entry} />)}
{relatedPosts.map((entry) => <CardRelated blogEntry={entry} recentBlogLocale="fr" /> )}
</div>
</section>
</MainLayout>