format file

This commit is contained in:
vcoppe
2025-02-15 13:09:41 +01:00
parent bc3b1e5f7c
commit b5bf06b37a

View File

@@ -1,30 +1,30 @@
import { guides } from '$lib/components/docs/docs.js';
function getModule(language: string | undefined, guide: string) {
language = language ?? 'en';
let subguide = undefined;
if (guide.includes('/')) {
[guide, subguide] = guide.split('/');
}
return subguide
? import(`./../lib/docs/${language}/${guide}/${subguide}.mdx`)
: import(`./../lib/docs/${language}/${guide}.mdx`);
language = language ?? 'en';
let subguide = undefined;
if (guide.includes('/')) {
[guide, subguide] = guide.split('/');
}
return subguide
? import(`./../lib/docs/${language}/${guide}/${subguide}.mdx`)
: import(`./../lib/docs/${language}/${guide}.mdx`);
}
export async function load({ params }) {
const { language } = params;
const { language } = params;
const guideTitles: Record<string, string> = {};
for (let guide of Object.keys(guides)) {
guideTitles[guide] = (await getModule(language, guide)).metadata.title;
for (let subguide of guides[guide]) {
guideTitles[`${guide}/${subguide}`] = (
await getModule(language, `${guide}/${subguide}`)
).metadata.title;
}
}
const guideTitles: Record<string, string> = {};
for (let guide of Object.keys(guides)) {
guideTitles[guide] = (await getModule(language, guide)).metadata.title;
for (let subguide of guides[guide]) {
guideTitles[`${guide}/${subguide}`] = (
await getModule(language, `${guide}/${subguide}`)
).metadata.title;
}
}
return {
guideTitles
};
return {
guideTitles,
};
}