diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 2bf9333..1d3aa98 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -5,7 +5,7 @@ interface Props { title: string; description?: string; image?: string; - lang?: string; + lang?: "en" | "no"; seo_title?: string; search_description?: string; introText?: string; diff --git a/src/pages/news/[slug].astro b/src/pages/news/[slug].astro index 83224fd..a519841 100644 --- a/src/pages/news/[slug].astro +++ b/src/pages/news/[slug].astro @@ -33,6 +33,7 @@ const article = await fetchArticleById({ search_description=`${article.meta.search_description}` introText=`${article.intro}` type="article" + lang=`${article.meta.locale || "no"}` image=`${article.main_image?.sizes.large.url}` >
diff --git a/src/utils/articles.ts b/src/utils/articles.ts index 196caf5..17025cd 100644 --- a/src/utils/articles.ts +++ b/src/utils/articles.ts @@ -8,6 +8,7 @@ export interface Article { first_published_at: string; seo_title: string; search_description: string; + locale?: "en" | "no"; }; title: string; intro: string; @@ -110,7 +111,7 @@ export const fetchArticleById = async ({ id: number; api_url: string; }): Promise
=> { - const response = await fetch(`${api_url}api/v2/news/${id}/`); + const response = await fetch(`${api_url}api/v2/news/${id}/?fields=locale`); const data = await response.json(); return data; };