@@ -6,12 +6,11 @@ import { dirname, resolve } from 'node:path'
66import {
77 buildLocaleRedirectScript ,
88 DEFAULT_WIKI_LOCALE ,
9- getWikiContentLocales ,
10- resolveContentLocale ,
119 WIKI_UI_LOCALES ,
1210} from '../ci/lib/tfg-locale.mjs'
1311import { buildVitePressBootstrapScript } from '../ci/lib/tfg-theme.mjs'
1412import { assertUiLocales , buildSearchOptions , buildThemeConfig , loadUiLocales } from './i18n/index.ts'
13+ import { homeEditLinkPlugin } from './plugins/home-edit-link.mts'
1514import {
1615 buildPageSeoHead ,
1716 buildWebSiteJsonLd ,
@@ -23,8 +22,6 @@ const __dirname = dirname(fileURLToPath(import.meta.url))
2322const GITHUB_ORG = 'TerraFirmaGreg-Team'
2423const GITHUB_REPO = `${ GITHUB_ORG } /Wiki`
2524const NAMESPACE = 'modern'
26- const DOCS_ROOT = resolve ( __dirname , '..' , 'docs' )
27- const CONTENT_LOCALES = getWikiContentLocales ( DOCS_ROOT )
2825const SITE_DOMAIN = readFileSync ( resolve ( __dirname , '..' , 'public' , 'CNAME' ) , 'utf8' ) . trim ( )
2926const SITE_URL = `https://${ SITE_DOMAIN } `
3027const OG_IMAGE = `${ SITE_URL } /logo.png`
@@ -44,10 +41,9 @@ function localeBase(locale: Locale) {
4441}
4542
4643function sidebarOptions ( locale : Locale ) : VitePressSidebarOptions {
47- const contentLocale = resolveContentLocale ( locale , CONTENT_LOCALES )
4844 return {
4945 documentRootPath : '/docs' ,
50- scanStartPath : `${ NAMESPACE } /${ contentLocale } ` ,
46+ scanStartPath : `${ NAMESPACE } /${ locale } ` ,
5147 resolvePath : `${ localeBase ( locale ) } /` ,
5248 collapsed : false ,
5349 useTitleFromFrontmatter : true ,
@@ -81,8 +77,8 @@ export default defineConfig(
8177 publicDir : resolve ( __dirname , '..' , 'public' ) ,
8278 define : {
8379 'import.meta.env.VITE_EXTRA_EXTENSIONS' : JSON . stringify ( 'html' ) ,
84- __WIKI_CONTENT_LOCALES__ : JSON . stringify ( CONTENT_LOCALES ) ,
8580 } ,
81+ plugins : [ homeEditLinkPlugin ( resolve ( __dirname , '..' , 'docs' ) , UI , GITHUB_REPO ) ] ,
8682 } ,
8783 title : SITE_TITLE ,
8884 description : SITE_DESCRIPTION ,
@@ -112,7 +108,7 @@ export default defineConfig(
112108 transformHead ( { page, title, description } ) {
113109 const head = buildPageSeoHead ( SITE_URL , page , title , description , OG_IMAGE )
114110 if ( page === 'index.md' ) {
115- head . push ( [ 'script' , { } , buildLocaleRedirectScript ( CONTENT_LOCALES ) ] )
111+ head . push ( [ 'script' , { } , buildLocaleRedirectScript ( ) ] )
116112 }
117113 return head
118114 } ,
0 commit comments