fix: property 'slug' does not exist
This commit is contained in:
parent
ebaacb466a
commit
987efc0339
12 changed files with 25 additions and 25 deletions
|
@ -20,8 +20,8 @@ interface Props {
|
|||
<a
|
||||
class="group relative block rounded-xl outline-none ring-zinc-500 transition duration-500 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none"
|
||||
href={blogLocale && blogLocale !== "en"
|
||||
? `/${blogLocale}/blog/${blogEntry.slug.replace(/^fr\//, "")}/`
|
||||
: `/blog/${blogEntry.slug.replace(/^en\//, "")}/`}
|
||||
? `/${blogLocale}/blog/${blogEntry.id.replace(/^fr\//, "")}/`
|
||||
: `/blog/${blogEntry.id.replace(/^en\//, "")}/`}
|
||||
data-astro-prefetch
|
||||
>
|
||||
<!-- The container for the blog post's cover image. Uses astro:assets' Image for image source -->
|
||||
|
|
|
@ -36,7 +36,7 @@ interface Props {
|
|||
>
|
||||
<a
|
||||
class="outline-none ring-zinc-500 transition duration-300 hover:text-orange-400 focus-visible:ring dark:text-neutral-300 dark:ring-zinc-200 dark:hover:text-neutral-50 dark:focus:outline-none"
|
||||
href={recentBlogLocale && recentBlogLocale !== "en" ? `/${recentBlogLocale}/blog/${blogEntry.slug.replace(/^fr\//, '')}/` : `/blog/${blogEntry.slug.replace(/^en\//, '')}/`}
|
||||
href={recentBlogLocale && recentBlogLocale !== "en" ? `/${recentBlogLocale}/blog/${blogEntry.id.replace(/^fr\//, '')}/` : `/blog/${blogEntry.id.replace(/^en\//, '')}/`}
|
||||
>
|
||||
{blogEntry.data.description}
|
||||
</a>
|
||||
|
@ -57,7 +57,7 @@ interface Props {
|
|||
<!-- Read More button which is a link to the blog post detailed page -->
|
||||
<div class="mt-5">
|
||||
<PrimaryCTA
|
||||
url={recentBlogLocale && recentBlogLocale !== "en" ? `/${recentBlogLocale}/blog/${blogEntry.slug.replace(/^fr\//, '')}/` : `/blog/${blogEntry.slug.replace(/^en\//, '')}/`}
|
||||
url={recentBlogLocale && recentBlogLocale !== "en" ? `/${recentBlogLocale}/blog/${blogEntry.id.replace(/^fr\//, '')}/` : `/blog/${blogEntry.id.replace(/^en\//, '')}/`}
|
||||
title="Read More"
|
||||
data-astro-prefetch
|
||||
/>
|
||||
|
|
|
@ -21,8 +21,8 @@ interface Props {
|
|||
<a
|
||||
class="group rounded-xl outline-none ring-zinc-500 transition duration-300 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none"
|
||||
href={insightLocale && insightLocale !== "en"
|
||||
? `/${insightLocale}/insights/${insightEntry.slug.replace(/^fr\//, "")}/`
|
||||
: `/insights/${insightEntry.slug.replace(/^en\//, "")}/`}
|
||||
? `/${insightLocale}/insights/${insightEntry.id.replace(/^fr\//, "")}/`
|
||||
: `/insights/${insightEntry.id.replace(/^en\//, "")}/`}
|
||||
>
|
||||
<!-- This is the container for the insight's cover image. -->
|
||||
<div class="relative overflow-hidden rounded-xl pt-[50%] sm:pt-[70%]">
|
||||
|
|
|
@ -15,8 +15,8 @@ interface Props {
|
|||
<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={recentBlogLocale && recentBlogLocale !== "en"
|
||||
? `/${recentBlogLocale}/blog/${blogEntry.slug.replace(/^fr\//, "")}/`
|
||||
: `/blog/${blogEntry.slug.replace(/^en\//, "")}/`}
|
||||
? `/${recentBlogLocale}/blog/${blogEntry.id.replace(/^fr\//, "")}/`
|
||||
: `/blog/${blogEntry.id.replace(/^en\//, "")}/`}
|
||||
data-astro-prefetch
|
||||
>
|
||||
<div>
|
||||
|
|
|
@ -19,8 +19,8 @@ const imageClass =
|
|||
<!-- A clickable card that leads to the details of the product-->
|
||||
<a
|
||||
href={productLocale && productLocale !== "en"
|
||||
? `/${productLocale}/products/${product.slug.replace(/^fr\//, "")}/`
|
||||
: `/products/${product.slug.replace(/^en\//, "")}/`}
|
||||
? `/${productLocale}/products/${product.id.replace(/^fr\//, "")}/`
|
||||
: `/products/${product.id.replace(/^en\//, "")}/`}
|
||||
data-astro-prefetch
|
||||
class="group relative flex h-48 items-end overflow-hidden rounded-xl shadow-lg outline-none ring-zinc-500 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none md:h-80"
|
||||
>
|
||||
|
|
|
@ -19,8 +19,8 @@ const imageClass =
|
|||
<!-- The anchor tag is the main container for the product card. When clicked, this leads to the details of the product. -->
|
||||
<a
|
||||
href={productLocale && productLocale !== "en"
|
||||
? `/${productLocale}/products/${product.slug.replace(/^fr\//, "")}/`
|
||||
: `/products/${product.slug.replace(/^en\//, "")}/`}
|
||||
? `/${productLocale}/products/${product.id.replace(/^fr\//, "")}/`
|
||||
: `/products/${product.id.replace(/^en\//, "")}/`}
|
||||
data-astro-prefetch
|
||||
class="group relative flex h-48 items-end overflow-hidden rounded-lg shadow-xl outline-none ring-zinc-500 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none md:col-span-2 md:h-80"
|
||||
>
|
||||
|
|
|
@ -18,9 +18,9 @@ export async function getStaticPaths() {
|
|||
id.startsWith("en/")
|
||||
);
|
||||
return blogPosts.map((post) => {
|
||||
const slugWithoutLang = post.id.replace(/^en\//, ""); // Remove the "en/" prefix
|
||||
const idWithoutLang = post.id.replace(/^en\//, ""); // Remove the "en/" prefix
|
||||
return {
|
||||
params: { id: slugWithoutLang },
|
||||
params: { id: idWithoutLang },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
|
|
|
@ -18,9 +18,9 @@ export async function getStaticPaths() {
|
|||
id.startsWith("fr/")
|
||||
);
|
||||
return blogPosts.map((post) => {
|
||||
const slugWithoutLang = post.slug.replace(/^fr\//, ""); // Remove the "fr/" prefix
|
||||
const idWithoutLang = post.id.replace(/^fr\//, ""); // Remove the "fr/" prefix
|
||||
return {
|
||||
params: { lang: "fr", slug: slugWithoutLang },
|
||||
params: { lang: "fr", id: idWithoutLang },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection(
|
|||
({ id }) => id.startsWith("fr/")
|
||||
);
|
||||
const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
|
||||
(blogEntry) => blogEntry.slug !== post.slug
|
||||
(blogEntry) => blogEntry.id !== post.id
|
||||
);
|
||||
|
||||
const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
||||
|
|
|
@ -9,9 +9,9 @@ import { getCollection, render } from "astro:content";
|
|||
export async function getStaticPaths() {
|
||||
const insightPosts = await getCollection("insights", ({ id }) => id.startsWith("fr/"));
|
||||
return insightPosts.map((post) => {
|
||||
const slugWithoutLang = post.id.replace(/^fr\//, ''); // Remove the "fr/" prefix
|
||||
const idWithoutLang = post.id.replace(/^fr\//, ''); // Remove the "fr/" prefix
|
||||
return {
|
||||
params: { lang: 'fr', id: slugWithoutLang },
|
||||
params: { lang: 'fr', id: idWithoutLang },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
|
|
|
@ -20,9 +20,9 @@ export async function getStaticPaths() {
|
|||
id.startsWith("fr/")
|
||||
);
|
||||
return productEntries.map((product) => {
|
||||
const slugWithoutLang = product.slug.replace(/^fr\//, ""); // Remove the "fr/" prefix
|
||||
const idWithoutLang = product.id.replace(/^fr\//, ""); // Remove the "fr/" prefix
|
||||
return {
|
||||
params: { lang: "fr", slug: slugWithoutLang },
|
||||
params: { lang: "fr", id: idWithoutLang },
|
||||
props: { product },
|
||||
};
|
||||
});
|
||||
|
|
|
@ -11,9 +11,9 @@ export async function getStaticPaths() {
|
|||
id.startsWith("en/")
|
||||
);
|
||||
return insightPosts.map((post) => {
|
||||
const slugWithoutLang = post.id.replace(/^en\//, ""); // Remove the "fr/" prefix
|
||||
const idWithoutLang = post.id.replace(/^en\//, ""); // Remove the "fr/" prefix
|
||||
return {
|
||||
params: { id: slugWithoutLang },
|
||||
params: { id: idWithoutLang },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
|
|
|
@ -21,9 +21,9 @@ export async function getStaticPaths() {
|
|||
id.startsWith("en/")
|
||||
);
|
||||
return productEntries.map((product) => {
|
||||
const slugWithoutLang = product.id.replace(/^en\//, ""); // Remove the "en/" prefix
|
||||
const idWithoutLang = product.id.replace(/^en\//, ""); // Remove the "en/" prefix
|
||||
return {
|
||||
params: { id: slugWithoutLang },
|
||||
params: { id: idWithoutLang },
|
||||
props: { product },
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue