fix: paths

This commit is contained in:
tresabhi committed 2025-01-16 20:34:28 -06:00
1 parent bcde319ac1
commit ee94d762d0
3 files changed
+35 -25

No files matched your search

+9 -8
View File
@@ -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',
}}
>
<Link href="/docs/about/credits" color="gray">
<LinkI18n {locale} href="/docs/about/credits" color="gray">
{strings.website.footer.about.credits}
</Link>
</LinkI18n>
<Link
href="https://discord.gg/nDt7AjGJQH"
target="_blank"
@@ -95,9 +96,9 @@ const strings = getStrings(locale);
>
{strings.website.footer.about.github}
</Link>
<Link href="/docs/patches" color="gray">
<LinkI18n {locale} href="/docs/patches" color="gray">
{strings.website.footer.about.patches}
</Link>
</LinkI18n>
</Flex>
</Flex>
@@ -115,12 +116,12 @@ const strings = getStrings(locale);
>
<Heading size="3">{strings.website.footer.legal.title}</Heading>
<Flex direction="column">
<Link href="/docs/legal/privacy-policy" color="gray">
<LinkI18n {locale} href="/docs/legal/privacy-policy" color="gray">
{strings.website.footer.legal.privacy}
</Link>
<Link href="/docs/legal/terms-of-service" color="gray">
</LinkI18n>
<LinkI18n {locale} href="/docs/legal/terms-of-service" color="gray">
{strings.website.footer.legal.terms}
</Link>
</LinkI18n>
</Flex>
</Flex>
</Flex>
@@ -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;
@@ -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,
}),
)