1+ import { createContentLoader , defineConfig , type DefaultTheme } from 'vitepress'
2+ import { generateSidebarItems , getFiles } from './sidebar'
3+
4+ const isBuild = process . env . NODE_ENV === 'production'
5+ const baseUrl = isBuild && '/libremesh.github.io' || ''
6+
7+ const libremesh = {
8+ stable_version : '2024.1' ,
9+ stable_branch_openwrt : [ '23.05' ] ,
10+ oldstable_version : '2020.4' ,
11+ oldstable_branch_openwrt : [ '19.07' ] ,
12+ }
13+
14+ const packages = await getFiles ( 'docs/packages/*.md' ) ; // Path to folder
15+
16+ // https://vitepress.dev/reference/site-config
17+ export default defineConfig ( {
18+ title : "LibreMesh" ,
19+ description : "A modular framework for creating OpenWrt-based firmwares for wireless mesh nodes" ,
20+ head : [ [ 'link' , { rel : 'icon' , href : baseUrl + '/favicon.ico' } ] ] ,
21+ lastUpdated : true ,
22+ base : baseUrl ,
23+ metaChunk : true ,
24+
25+ locales : {
26+ root : {
27+ label : 'English' ,
28+ lang : 'en'
29+ } ,
30+ } ,
31+
32+ themeConfig : {
33+ // https://vitepress.dev/reference/default-theme-config
34+ logo : { light : '/libremesh_logo.svg' , dark : '/libremesh_logo.svg' , alt : 'Logo' } ,
35+ siteTitle : false ,
36+ editLink : {
37+ pattern : 'https://github.com/a-gave/libremesh.github.io/edit/main/docs/:path' ,
38+ text : 'Edit this page on GitHub'
39+ } ,
40+ search : {
41+ provider : 'local'
42+ } ,
43+
44+ nav : nav ( ) ,
45+
46+ sidebar : {
47+ '/' : { base : '/' , items : sidebarGuide ( ) } ,
48+ '/reference/' : { base : '/reference/' , items : sidebarReference ( ) }
49+ } ,
50+
51+ socialLinks : [
52+ { icon : 'github' , link : 'https://github.com/libremesh/lime-packages' } ,
53+ // { icon: 'maildotru', link: 'https://www.autistici.org/mailman/listinfo/libremesh' },
54+ { icon : 'matrix' , link : 'https://matrix.to/#/#libremesh-dev:matrix.guifi.net' } ,
55+ { icon : 'mastodon' , link : 'https://social.freifunk.net/@libremesh' } ,
56+ { icon : 'peertube' , link : 'https://media.exo.cat/a/libremesh' }
57+ ] ,
58+ } ,
59+ // async buildEnd() {
60+ // // const meetings = await createContentLoader('meetings/*.md').load()
61+ // // generate files based on posts metadata, e.g. RSS feed
62+ // }
63+ } )
64+
65+ function nav ( ) : DefaultTheme . NavItem [ ] {
66+ return [
67+ { text : 'Reference' , link : '/reference/configuration' } ,
68+ // { text: 'News', link: '/news' },
69+ { text : 'v2024.1' ,
70+ items : [
71+ { text : 'v2020.4' , link : '/news/2023-10-07' } ,
72+ { text : 'News' , link : '/news' } ,
73+ { text : 'Changelog' , link : 'https://github.com/libremesh/lime-packages/tree/master/CHANGELOG.md' } ,
74+ { text : 'Issues' , link : 'https://github.com/libremesh/lime-packages/issues' } ,
75+ ]
76+ } ,
77+ ]
78+ }
79+
80+ function sidebarGuide ( ) : DefaultTheme . SidebarItem [ ] {
81+ return [
82+ {
83+ text : 'Introduction' ,
84+ collapsed : false ,
85+ items : [
86+ { text : 'What is LibreMesh?' , link : '/what-is-libremesh' } ,
87+ { text : 'Getting Started' , link : '/getting-started' } ,
88+ { text : 'Features' , link : '/features' } ,
89+ ]
90+ } ,
91+ {
92+ text : 'User Guide' ,
93+ collapsed : false ,
94+ items : [
95+ { text : 'Connecting to the router' , link : '/install/connecting' } ,
96+ { text : 'Packages selection' ,
97+ link : '/install/packages-selection' ,
98+ collapsed : true ,
99+ items : [
100+ { text : 'Build customization' , link : '/install/packages-selection' } ,
101+ { text : 'Network Profiles' , link : '/install/network-profiles' }
102+ ] } ,
103+ { text : 'Build LibreMesh' ,
104+ link : '/build' ,
105+ collapsed : true ,
106+ items : [
107+ { text : 'Build methods' , link : '/build/' } ,
108+ { text : 'Imagebuilder' , link : '/build/imagebuilder' } ,
109+ { text : 'Buildroot' , link : '/build/buildroot/debian' }
110+ ] }
111+ ]
112+ } ,
113+ {
114+ text : 'Developer Guide' ,
115+ collapsed : false ,
116+ items : [
117+ { text : 'Run it on QEMU' , link : '/install/qemu' }
118+ ]
119+ } ,
120+ {
121+ text : 'Community' ,
122+ collapsed : false ,
123+ items : [
124+ { text : 'Communication' , link : '/communication' } ,
125+ { text : 'Contribute' , link : '/contribute' } ,
126+ { text : 'Meetings' , link : '/meetings' } ,
127+ { text : 'News' , link : '/news' }
128+
129+ ]
130+ } ,
131+ {
132+ text : 'Resources' ,
133+ collapsed : false ,
134+ link : '/resources' ,
135+ items : [
136+ { text : 'Media list' , link : '/resources/media_list' } ,
137+ { text : 'Related projects' , link : '/resources/related_projects' } ,
138+ { text : 'Tools' ,
139+ link : '/resources/tools/monitoring' ,
140+ collapsed : true ,
141+ items : [
142+ { text : 'Monitoring' , link : '/resources/tools/monitoring' } ,
143+ ] } ,
144+ ]
145+ } ,
146+ {
147+ text : 'Packages' ,
148+ collapsed : false ,
149+ link : '/resources' ,
150+ items : generateSidebarItems ( packages ) ,
151+ } ,
152+ ]
153+ }
154+
155+
156+ function sidebarReference ( ) : DefaultTheme . SidebarItem [ ] {
157+ return [
158+ {
159+ text : 'Reference' ,
160+ items : [
161+ { text : 'Configuration' , link : 'configuration' } ,
162+ { text : 'Flavors' , link : '/reference/flavors' } ,
163+ { text : 'lime-files' , items : [
164+ { text : 'System options' , link : 'system' } ,
165+ { text : 'Network options' , link : 'network/' , items : [
166+ { text : 'Protocols list' , link : 'network/protocols-list' } ,
167+ { text : 'Protocols options' , link : 'network/protocols-options' } ,
168+ { text : 'Interface specific' , link : 'network/interface-specific' } ,
169+ ] } ,
170+ { text : 'Wifi' , link : 'wifi' , items : [
171+ { text : 'Band specific' , link : 'wifi#wifi-band-specific-options' } ,
172+ { text : 'Interface specific' , link : 'wifi#wifi-interface-specific-options' } ,
173+ { text : 'Client mode' , link : 'wifi#wifi-client-mode' } ,
174+ { text : 'Backbone AP' , link : 'wifi#wifi-backbone-ap' } ,
175+ ] } ,
176+ { text : 'Generic UCI configs' , link : 'openwrt_configs' } ,
177+ { text : 'BGP' , link : 'bgp' } ,
178+ { text : 'Ground Routing' , link : 'wifi' } ,
179+ { text : 'Watchcat' , link : 'watchcat' }
180+ ] }
181+ ]
182+ }
183+ ]
184+ }
0 commit comments