From aba5b4e4879712b691532f855eb718d12dd5b9e5 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:32:43 +0100 Subject: Moves localeStaticPaths --- src/lib/localeStaticPaths.ts | 10 ++++++++++ src/pages/[locale]/index.astro | 4 ++-- src/pages/[locale]/staticPaths.ts | 10 ---------- 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 src/lib/localeStaticPaths.ts delete mode 100644 src/pages/[locale]/staticPaths.ts (limited to 'src') diff --git a/src/lib/localeStaticPaths.ts b/src/lib/localeStaticPaths.ts new file mode 100644 index 0000000..55c3d9a --- /dev/null +++ b/src/lib/localeStaticPaths.ts @@ -0,0 +1,10 @@ +import type Locale from '../types/Locale'; + +// Defines what values to insert into the [locale] URL path parameter +// when generating a static site +const localeStaticPaths: { params: { locale: Locale} }[] = [ + { params: { locale: 'sco' } }, + { params: { locale: 'en-GB' } }, +] + +export default localeStaticPaths; diff --git a/src/pages/[locale]/index.astro b/src/pages/[locale]/index.astro index 23a270d..7552cd0 100644 --- a/src/pages/[locale]/index.astro +++ b/src/pages/[locale]/index.astro @@ -1,12 +1,12 @@ --- import Layout from '../../layouts/Layout.astro'; -import staticPaths from './staticPaths'; +import localeStaticPaths from '../../lib/localeStaticPaths'; import translate from '../../i18n/translate'; import site from '../../i18n/translations/site'; import home from '../../i18n/translations/pages/home'; import type Locale from '../../types/Locale'; -export async function getStaticPaths() { return staticPaths; } +export async function getStaticPaths() { return localeStaticPaths; } const locale = Astro.params.locale as Locale; const t = translate(locale); diff --git a/src/pages/[locale]/staticPaths.ts b/src/pages/[locale]/staticPaths.ts deleted file mode 100644 index 266ad2c..0000000 --- a/src/pages/[locale]/staticPaths.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type Locale from '../../types/Locale'; - -// Defines what values to insert into the [locale] URL path parameter -// when generating a static site -const staticPaths: { params: { locale: Locale} }[] = [ - { params: { locale: 'sco' } }, - { params: { locale: 'en-GB' } }, -] - -export default staticPaths; \ No newline at end of file -- cgit v1.2.3