From ee94d762d0589ca877bea69ddaede4ed71ba4717 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:34:28 -0600 Subject: [PATCH] fix: paths --- packages/website/src/components/Footer.astro | 17 ++++---- .../docs/[directory]/[document]/index.astro | 39 ++++++++++++------- .../[...locale]/docs/patches/index.astro | 4 +- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/packages/website/src/components/Footer.astro b/packages/website/src/components/Footer.astro index 77c7dc7a6..2a3a9d4cd 100644 --- a/packages/website/src/components/Footer.astro +++ b/packages/website/src/components/Footer.astro @@ -4,6 +4,7 @@ import { DEFAULT_LOCALE } from '@blitzkit/i18n'; import { Box, Code, Flex, Heading, Link, Text } from '@radix-ui/themes'; import packageJson from '../../../../package.json'; import { getStrings } from '../core/i18n/getStrings'; +import { LinkI18n } from './LinkI18n'; import { LocaleSwitcherThemeWrapper } from './LocaleSwitcher'; const gameDefinitions = await fetchGameDefinitions(); @@ -78,9 +79,9 @@ const strings = getStrings(locale); sm: 'start', }} > - + {strings.website.footer.about.credits} - + {strings.website.footer.about.github} - + {strings.website.footer.about.patches} - + @@ -115,12 +116,12 @@ const strings = getStrings(locale); > {strings.website.footer.legal.title} - + {strings.website.footer.legal.privacy} - - + + {strings.website.footer.legal.terms} - + diff --git a/packages/website/src/pages/[...locale]/docs/[directory]/[document]/index.astro b/packages/website/src/pages/[...locale]/docs/[directory]/[document]/index.astro index 0a094ea23..b3ec6f8e3 100644 --- a/packages/website/src/pages/[...locale]/docs/[directory]/[document]/index.astro +++ b/packages/website/src/pages/[...locale]/docs/[directory]/[document]/index.astro @@ -2,28 +2,37 @@ import type { GetStaticPaths } from 'astro'; import { readFile } from 'fs/promises'; import BaseLayout from '../../../../../layouts/BaseLayout.astro'; +import { getStaticPaths as parentGetStaticPaths } from '../../../index.astro'; import { Page } from './_index'; export const getStaticPaths = (async () => { - const ROOT = '../../../../../../../docs/'; - const files = import.meta.glob('../../../../../../../docs/**/*.md', { + const parentPaths = parentGetStaticPaths(); + + const ROOT = '../../../../../../../../docs/'; + const files = import.meta.glob('../../../../../../../../docs/**/*.md', { eager: true, }); - return await Promise.all( - Object.keys(files).map(async (file) => { - const couple = file.replace(ROOT, '').split('/'); - couple[1] = couple[1].replace('.md', ''); - const content = await readFile( - `../../docs/${couple[0]}/${couple[1]}.md`, - ).then((buffer) => buffer.toString()); + return ( + await Promise.all( + Object.keys(files).map(async (file) => { + const couple = file.replace(ROOT, '').split('/'); + couple[1] = couple[1].replace('.md', ''); + const content = await readFile( + `../../docs/${couple[0]}/${couple[1]}.md`, + ).then((buffer) => buffer.toString()); - return { - params: { directory: couple[0], document: couple[1] }, - props: { content }, - }; - }), - ); + return parentPaths.map((parent) => ({ + params: { + ...parent.params, + directory: couple[0], + document: couple[1], + }, + props: { content }, + })); + }), + ) + ).flat(); }) satisfies GetStaticPaths; const { content } = Astro.props; diff --git a/packages/website/src/pages/[...locale]/docs/patches/index.astro b/packages/website/src/pages/[...locale]/docs/patches/index.astro index d48c04659..b9521e432 100644 --- a/packages/website/src/pages/[...locale]/docs/patches/index.astro +++ b/packages/website/src/pages/[...locale]/docs/patches/index.astro @@ -8,10 +8,10 @@ import BaseLayout from '../../../../layouts/BaseLayout.astro'; export { getStaticPaths } from '../../index.astro'; // this can't be used in template literal :( -const ROOT = '../../../../../../docs/changelogs/'; +const ROOT = '../../../../../../../docs/changelogs/'; const versions = Object.keys( - import.meta.glob(`../../../../../../docs/changelogs/*.md`, { + import.meta.glob('../../../../../../../docs/changelogs/*.md', { eager: true, }), )