diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro index 70d5b55..fbc8fc4 100644 --- a/src/components/Breadcrumbs.astro +++ b/src/components/Breadcrumbs.astro @@ -4,7 +4,7 @@ const currentUrlPath = Astro.url.pathname.replace(/\/+$/, ""); // Get url array from path // eg: /tags/tailwindcss => ['tags', 'tailwindcss'] -const breadcrumbList = currentUrlPath.split("/").slice(1); +const breadcrumbList = currentUrlPath?.split("/").slice(1) || []; // if breadcrumb is Home > Posts > 1 // replace Posts with Posts (page number) diff --git a/src/pages/index.astro b/src/pages/index.astro index f129979..0305e93 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -10,6 +10,11 @@ import getSortedPosts from "@utils/getSortedPosts"; import { SITE, SOCIALS } from "@config"; import { getCollection } from "astro:content"; import type Store from "../interfaces/Store"; +import type Page from "../interfaces/Page"; +import { + BlocksRenderer, + type BlocksContent, +} from "@strapi/blocks-react-renderer"; const stores = await getCollection("stores"); const store = stores?.[0]?.data as unknown as Store; @@ -23,7 +28,10 @@ const recentPosts = sortedPosts.filter(({ data }) => !data.featured); const socialCount = SOCIALS.filter(social => social.active).length; - +const pages = await getCollection("pages"); +const homePage = pages.find( + page => (page as unknown as { data: Page }).data.slug === "home" +) as unknown as { data: Page }; const links = store?.Links || []; const products = store?.products?.data || []; @@ -71,9 +79,14 @@ const products = store?.products?.data || []; /> ) } - - - + +
+ +
+
+
{ links && links.length > 0 && (