mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-30 23:30:04 +00:00
format file
This commit is contained in:
@@ -1,30 +1,30 @@
|
|||||||
import { guides } from '$lib/components/docs/docs.js';
|
import { guides } from '$lib/components/docs/docs.js';
|
||||||
|
|
||||||
function getModule(language: string | undefined, guide: string) {
|
function getModule(language: string | undefined, guide: string) {
|
||||||
language = language ?? 'en';
|
language = language ?? 'en';
|
||||||
let subguide = undefined;
|
let subguide = undefined;
|
||||||
if (guide.includes('/')) {
|
if (guide.includes('/')) {
|
||||||
[guide, subguide] = guide.split('/');
|
[guide, subguide] = guide.split('/');
|
||||||
}
|
}
|
||||||
return subguide
|
return subguide
|
||||||
? import(`./../lib/docs/${language}/${guide}/${subguide}.mdx`)
|
? import(`./../lib/docs/${language}/${guide}/${subguide}.mdx`)
|
||||||
: import(`./../lib/docs/${language}/${guide}.mdx`);
|
: import(`./../lib/docs/${language}/${guide}.mdx`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function load({ params }) {
|
export async function load({ params }) {
|
||||||
const { language } = params;
|
const { language } = params;
|
||||||
|
|
||||||
const guideTitles: Record<string, string> = {};
|
const guideTitles: Record<string, string> = {};
|
||||||
for (let guide of Object.keys(guides)) {
|
for (let guide of Object.keys(guides)) {
|
||||||
guideTitles[guide] = (await getModule(language, guide)).metadata.title;
|
guideTitles[guide] = (await getModule(language, guide)).metadata.title;
|
||||||
for (let subguide of guides[guide]) {
|
for (let subguide of guides[guide]) {
|
||||||
guideTitles[`${guide}/${subguide}`] = (
|
guideTitles[`${guide}/${subguide}`] = (
|
||||||
await getModule(language, `${guide}/${subguide}`)
|
await getModule(language, `${guide}/${subguide}`)
|
||||||
).metadata.title;
|
).metadata.title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
guideTitles
|
guideTitles,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user