diff options
| -rw-r--r-- | src/components/NewsPreviewLink.astro | 6 | ||||
| -rw-r--r-- | src/pages/[locale]/news/index.astro | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/components/NewsPreviewLink.astro b/src/components/NewsPreviewLink.astro index 99ecb60..566f136 100644 --- a/src/components/NewsPreviewLink.astro +++ b/src/components/NewsPreviewLink.astro @@ -1,15 +1,15 @@ --- import translate from '$i18n/translate'; import tNewsPreviewLink from '$i18n/translations/components/newsPreviewLink'; -import type Locale from '$types/Locale'; +import getLocaleFromPath from '$lib/getLocaleFromPath'; import type { CollectionEntry } from 'astro:content'; interface Props { - locale: Locale; newsItem: CollectionEntry<'news'>; } -const { locale, newsItem } = Astro.props; +const { newsItem } = Astro.props; +const locale = getLocaleFromPath(Astro.url.pathname); const t = translate(locale); --- diff --git a/src/pages/[locale]/news/index.astro b/src/pages/[locale]/news/index.astro index 42a17e2..0c81fd9 100644 --- a/src/pages/[locale]/news/index.astro +++ b/src/pages/[locale]/news/index.astro @@ -29,7 +29,7 @@ export async function getStaticPaths() { <div class="news-index"> { allNewsInLocale.length > 0 ? ( - allNewsInLocale.map((item) => <NewsPreviewLink locale={locale} newsItem={item} />) + allNewsInLocale.map((item) => <NewsPreviewLink newsItem={item} />) ) : ( <p>{t(tPage, { key: 'no-news' })}</p> ) |
