summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-13 14:03:51 +0100
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-13 14:03:51 +0100
commit07114baea46dad6a68ed18c8b9005777d2b12f75 (patch)
treeb6b98f4130dcb0ffb6fa660192c9b2b929ba3c4c
parent10262a450cc832f9c2124e986bdefb73707fa5e7 (diff)
Fixes Breadcrumbs
-rw-r--r--src/components/Breadcrumbs.astro7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro
index d29acee..5ebe759 100644
--- a/src/components/Breadcrumbs.astro
+++ b/src/components/Breadcrumbs.astro
@@ -5,25 +5,22 @@ import tBreadcrumbs from '../i18n/translations/components/breadcrumbs';
import type Locale from '../types/Locale';
import locales from '../i18n/locales';
-const path = Astro.url.pathname.replace(/(?!\/)$/, '/');
+const path = Astro.url.pathname.replace(/(?<!\/)$/, '/');
const localeInPath = new RegExp(`/(?<=^/)(${locales.join('|')})`);
const locale = path.match(localeInPath)?.[1] as Locale;
if (!locale) {
return;
}
const pathWithoutLocale = path.replace(new RegExp(`^/${locale}`), '');
-console.log('Path without locale: %s', pathWithoutLocale);
const slashIndices = findAllIndicesOf('/', pathWithoutLocale);
-console.log('Indices: (%s)', slashIndices.join(','));
const parentRoutes = slashIndices.map((n) => pathWithoutLocale.slice(0, n + 1)).slice(0, -1);
-console.log('Parent routes: (%s)', parentRoutes.join(','));
const t = translate(locale);
---
<ol class="breadcrumbs">
{
- /* parentRoutes.length > 1 && */ parentRoutes.map((route) => {
+ parentRoutes.map((route) => {
return (
<li>
<a class="link" href={`/${locale}${route}`}>