From 19351d3a896190d50f367a69e684f3d17b43baab Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Sat, 17 Sep 2022 00:33:37 +0630 Subject: [PATCH] Create Breadcrumbs component --- src/components/Breadcrumbs.astro | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/components/Breadcrumbs.astro diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro new file mode 100644 index 0000000..f3f9fec --- /dev/null +++ b/src/components/Breadcrumbs.astro @@ -0,0 +1,43 @@ +--- +const breadcrumbList = Astro.url.pathname.split("/").slice(1); + +// if breadcrumb is Home > Post > 'article-name' +// replace 'article-name' to 'current post' +if (breadcrumbList[0] === "posts" && breadcrumbList.length > 1) { + breadcrumbList.splice(1, 1, "current post"); +} +--- + + + +