diff options
Diffstat (limited to 'src/components/Navbar/Breadcrumbs.astro')
| -rw-r--r-- | src/components/Navbar/Breadcrumbs.astro | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/components/Navbar/Breadcrumbs.astro b/src/components/Navbar/Breadcrumbs.astro deleted file mode 100644 index f949873..0000000 --- a/src/components/Navbar/Breadcrumbs.astro +++ /dev/null @@ -1,31 +0,0 @@ ---- -import findAllIndicesOf from '$lib/findAllIndicesOf'; -import translate from '$i18n/translate'; -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 localeInPath = new RegExp(`/(?<=^/)(${locales.join('|')})`); -const locale = path.match(localeInPath)?.[1] as Locale; -if (!locale) { - return; -} -const pathWithoutLocale = path.replace(new RegExp(`^/${locale}`), ''); -const slashIndices = findAllIndicesOf('/', pathWithoutLocale); -const parentRoutes = slashIndices.map((n) => pathWithoutLocale.slice(0, n + 1)).slice(0, -1); - -const t = translate(locale); ---- - -<ol class="nav__breadcrumbs"> - { - parentRoutes.map((route) => { - return ( - <li> - <a href={`/${locale}${route}`}>{t(tBreadcrumbs, { key: route })}</a> - </li> - ); - }) - } -</ol> |
