fix: property 'slug' does not exist

This commit is contained in:
Emil Gulamov 2025-01-02 19:21:39 +04:00
parent ebaacb466a
commit 987efc0339
12 changed files with 25 additions and 25 deletions

View file

@ -20,8 +20,8 @@ interface Props {
<a <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" 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" href={blogLocale && blogLocale !== "en"
? `/${blogLocale}/blog/${blogEntry.slug.replace(/^fr\//, "")}/` ? `/${blogLocale}/blog/${blogEntry.id.replace(/^fr\//, "")}/`
: `/blog/${blogEntry.slug.replace(/^en\//, "")}/`} : `/blog/${blogEntry.id.replace(/^en\//, "")}/`}
data-astro-prefetch data-astro-prefetch
> >
<!-- The container for the blog post's cover image. Uses astro:assets' Image for image source --> <!-- The container for the blog post's cover image. Uses astro:assets' Image for image source -->

View file

@ -36,7 +36,7 @@ interface Props {
> >
<a <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" 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} {blogEntry.data.description}
</a> </a>
@ -57,7 +57,7 @@ interface Props {
<!-- Read More button which is a link to the blog post detailed page --> <!-- Read More button which is a link to the blog post detailed page -->
<div class="mt-5"> <div class="mt-5">
<PrimaryCTA <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" title="Read More"
data-astro-prefetch data-astro-prefetch
/> />

View file

@ -21,8 +21,8 @@ interface Props {
<a <a
class="group rounded-xl outline-none ring-zinc-500 transition duration-300 focus-visible:ring dark:ring-zinc-200 dark:focus:outline-none" 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" href={insightLocale && insightLocale !== "en"
? `/${insightLocale}/insights/${insightEntry.slug.replace(/^fr\//, "")}/` ? `/${insightLocale}/insights/${insightEntry.id.replace(/^fr\//, "")}/`
: `/insights/${insightEntry.slug.replace(/^en\//, "")}/`} : `/insights/${insightEntry.id.replace(/^en\//, "")}/`}
> >
<!-- This is the container for the insight's cover image. --> <!-- This is the container for the insight's cover image. -->
<div class="relative overflow-hidden rounded-xl pt-[50%] sm:pt-[70%]"> <div class="relative overflow-hidden rounded-xl pt-[50%] sm:pt-[70%]">

View file

@ -15,8 +15,8 @@ interface Props {
<a <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" 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" href={recentBlogLocale && recentBlogLocale !== "en"
? `/${recentBlogLocale}/blog/${blogEntry.slug.replace(/^fr\//, "")}/` ? `/${recentBlogLocale}/blog/${blogEntry.id.replace(/^fr\//, "")}/`
: `/blog/${blogEntry.slug.replace(/^en\//, "")}/`} : `/blog/${blogEntry.id.replace(/^en\//, "")}/`}
data-astro-prefetch data-astro-prefetch
> >
<div> <div>

View file

@ -19,8 +19,8 @@ const imageClass =
<!-- A clickable card that leads to the details of the product--> <!-- A clickable card that leads to the details of the product-->
<a <a
href={productLocale && productLocale !== "en" href={productLocale && productLocale !== "en"
? `/${productLocale}/products/${product.slug.replace(/^fr\//, "")}/` ? `/${productLocale}/products/${product.id.replace(/^fr\//, "")}/`
: `/products/${product.slug.replace(/^en\//, "")}/`} : `/products/${product.id.replace(/^en\//, "")}/`}
data-astro-prefetch 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" 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"
> >

View file

@ -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. --> <!-- The anchor tag is the main container for the product card. When clicked, this leads to the details of the product. -->
<a <a
href={productLocale && productLocale !== "en" href={productLocale && productLocale !== "en"
? `/${productLocale}/products/${product.slug.replace(/^fr\//, "")}/` ? `/${productLocale}/products/${product.id.replace(/^fr\//, "")}/`
: `/products/${product.slug.replace(/^en\//, "")}/`} : `/products/${product.id.replace(/^en\//, "")}/`}
data-astro-prefetch 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" 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"
> >

View file

@ -18,9 +18,9 @@ export async function getStaticPaths() {
id.startsWith("en/") id.startsWith("en/")
); );
return blogPosts.map((post) => { 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 { return {
params: { id: slugWithoutLang }, params: { id: idWithoutLang },
props: { post }, props: { post },
}; };
}); });

View file

@ -18,9 +18,9 @@ export async function getStaticPaths() {
id.startsWith("fr/") id.startsWith("fr/")
); );
return blogPosts.map((post) => { 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 { return {
params: { lang: "fr", slug: slugWithoutLang }, params: { lang: "fr", id: idWithoutLang },
props: { post }, props: { post },
}; };
}); });
@ -34,7 +34,7 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection(
({ id }) => id.startsWith("fr/") ({ id }) => id.startsWith("fr/")
); );
const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter( const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
(blogEntry) => blogEntry.slug !== post.slug (blogEntry) => blogEntry.id !== post.id
); );
const pageTitle: string = `${post.data.title} | ${SITE.title}`; const pageTitle: string = `${post.data.title} | ${SITE.title}`;

View file

@ -9,9 +9,9 @@ import { getCollection, render } from "astro:content";
export async function getStaticPaths() { export async function getStaticPaths() {
const insightPosts = await getCollection("insights", ({ id }) => id.startsWith("fr/")); const insightPosts = await getCollection("insights", ({ id }) => id.startsWith("fr/"));
return insightPosts.map((post) => { 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 { return {
params: { lang: 'fr', id: slugWithoutLang }, params: { lang: 'fr', id: idWithoutLang },
props: { post }, props: { post },
}; };
}); });

View file

@ -20,9 +20,9 @@ export async function getStaticPaths() {
id.startsWith("fr/") id.startsWith("fr/")
); );
return productEntries.map((product) => { 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 { return {
params: { lang: "fr", slug: slugWithoutLang }, params: { lang: "fr", id: idWithoutLang },
props: { product }, props: { product },
}; };
}); });

View file

@ -11,9 +11,9 @@ export async function getStaticPaths() {
id.startsWith("en/") id.startsWith("en/")
); );
return insightPosts.map((post) => { 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 { return {
params: { id: slugWithoutLang }, params: { id: idWithoutLang },
props: { post }, props: { post },
}; };
}); });

View file

@ -21,9 +21,9 @@ export async function getStaticPaths() {
id.startsWith("en/") id.startsWith("en/")
); );
return productEntries.map((product) => { 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 { return {
params: { id: slugWithoutLang }, params: { id: idWithoutLang },
props: { product }, props: { product },
}; };
}); });