--- // Remove current url path and remove trailing slash if exists const currentUrlPath = Astro.url.pathname.replace(/\/+$/, ""); // Get url array from path // eg: /tags/tailwindcss => ['tags', 'tailwindcss'] const breadcrumbList = currentUrlPath.split("/").slice(1); // if breadcrumb is Home > Posts > 1 // replace Posts with Posts (page number) if ( (breadcrumbList[0] === "posts" && !isNaN(Number(breadcrumbList[1]))) || (breadcrumbList[0] === "posts" && breadcrumbList.length < 2) ) { breadcrumbList.splice( 0, 2, `Posts (page ${breadcrumbList[1] ? breadcrumbList[1] : 1})` ); } ---