diff --git a/website/src/routes/+layout.server.ts b/website/src/routes/+layout.server.ts index ef8d1c54..d60f7402 100644 --- a/website/src/routes/+layout.server.ts +++ b/website/src/routes/+layout.server.ts @@ -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 = {}; - 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 = {}; + 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, + }; }