Skip to content

Commit 9c7df4a

Browse files
Refactor VitePress configuration for localization and navigation
- Simplify locales configuration by moving navigation to i18n config - Add project logo to theme configuration - Streamline locales and navigation setup - Enable local search provider
1 parent 631ccb7 commit 9c7df4a

File tree

1 file changed

+39
-57
lines changed

1 file changed

+39
-57
lines changed

.vitepress/config.mts

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -18,64 +18,16 @@ const vitePressConfig: UserConfig = {
1818
head: [
1919
['link', { rel: 'icon', href: '/favicon.ico' }]
2020
],
21-
// Configure locales
22-
locales: {
23-
root: {
24-
label: 'English',
25-
lang: 'en',
26-
link: '/',
27-
themeConfig: {
28-
nav: [
29-
{ text: 'Home', link: '/' },
30-
{ text: 'Getting Started', link: '/getting_started/' },
31-
{ text: 'Guides', link: '/guides/service_toml' },
32-
{
33-
text: 'Documentation',
34-
items: [
35-
{ text: 'Core Concepts', link: '/guides/concepts' },
36-
{ text: 'Architecture', link: '/guides/architecture' },
37-
{ text: 'Best Practices', link: '/guides/best_practices' }
38-
]
39-
},
40-
{ text: 'API', link: '/api/' }
41-
]
42-
}
43-
},
44-
pt: {
45-
label: 'Português',
46-
lang: 'pt',
47-
link: '/pt/',
48-
themeConfig: {
49-
nav: [
50-
{ text: 'Início', link: '/pt/' },
51-
{ text: 'Primeiros Passos', link: '/pt/getting_started/' },
52-
{ text: 'Guias', link: '/pt/guides/service_toml' },
53-
{
54-
text: 'Documentação',
55-
items: [
56-
{ text: 'Conceitos Básicos', link: '/pt/guides/concepts' },
57-
{ text: 'Arquitetura', link: '/pt/guides/architecture' },
58-
{ text: 'Melhores Práticas', link: '/pt/guides/best_practices' }
59-
]
60-
},
61-
{ text: 'API', link: '/pt/api/' }
62-
]
63-
}
64-
}
65-
},
66-
6721
themeConfig: {
68-
// Common theme config
22+
logo: 'https://avatars.githubusercontent.com/u/146955355',
6923
socialLinks: [
7024
{ icon: 'github', link: 'https://github.com/mikros-dev' },
71-
]
25+
],
7226
}
7327
}
7428

7529
const rootLocale = 'en'
7630
const supportedLocales = [rootLocale, 'pt'];
77-
78-
7931
const commonSidebarConfigs: VitePressSidebarOptions = {
8032
capitalizeFirst: true,
8133
capitalizeEachWords: true,
@@ -92,14 +44,44 @@ const vitePressSidebarConfig: VitePressSidebarOptions[] =
9244
};
9345
})
9446

95-
96-
9747
const vitePressI18nConfig: VitePressI18nOptions = {
98-
locales: [
99-
{ path: '/', locale: 'en' }, // Empty path for the root locale
100-
{ path: 'pt', locale: 'pt' }
101-
],
102-
rootLocale: 'en',
48+
locales: supportedLocales,
49+
rootLocale: rootLocale,
50+
searchProvider: 'local',
51+
themeConfig: {
52+
en: {
53+
nav: [
54+
{ text: 'Home', link: '/' },
55+
{ text: 'Getting Started', link: '/getting_started/' },
56+
{ text: 'Guides', link: '/guides/service_toml' },
57+
{
58+
text: 'Documentation',
59+
items: [
60+
{ text: 'Core Concepts', link: '/guides/concepts' },
61+
{ text: 'Architecture', link: '/guides/architecture' },
62+
{ text: 'Best Practices', link: '/guides/best_practices' }
63+
]
64+
},
65+
{ text: 'API', link: '/api/' }
66+
],
67+
},
68+
pt: {
69+
nav: [
70+
{ text: 'Início', link: '/pt/' },
71+
{ text: 'Primeiros Passos', link: '/pt/getting_started/' },
72+
{ text: 'Guias', link: '/pt/guides/service_toml' },
73+
{
74+
text: 'Documentação',
75+
items: [
76+
{ text: 'Conceitos Básicos', link: '/pt/guides/concepts' },
77+
{ text: 'Arquitetura', link: '/pt/guides/architecture' },
78+
{ text: 'Melhores Práticas', link: '/pt/guides/best_practices' }
79+
]
80+
},
81+
{ text: 'API', link: '/pt/api/' }
82+
],
83+
}
84+
}
10385
};
10486

10587

0 commit comments

Comments
 (0)