@@ -4,17 +4,34 @@ import type * as Preset from '@docusaurus/preset-classic';
44
55// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
66function getSiteTagline ( ) {
7- switch ( process . env . DOCUSAURUS_CURRENT_LOCALE ) {
7+ switch ( process . env . DOCUSAURUS_CURRENT_LOCALE ) {
88 case "zh-Hans" : return "强大而灵活的 iOS 自动化工具 —— 经典传承,始于 2015 年。" ;
99 default : return "Powerful and flexible automation tool for iOS since 2015." ;
1010 }
1111}
1212
13- function getEditUrl ( type : 'docs' | 'blog' | 'pages' ) {
14- switch ( process . env . DOCUSAURUS_CURRENT_LOCALE ) {
15- case "zh-Hans" : return `https://github.com/OwnGoalStudio/XXTouchElite/tree/main/i18n/zh-Hans/docusaurus-plugin-content- ${ type } /` ;
16- default : return "https://github.com/OwnGoalStudio/XXTouchElite/tree/main/" ;
13+ function getEditUrl ( params : { versionDocsDirPath : string , docPath : string , permalink : string , locale : string } ) {
14+ const rootPath = "https://github.com/OwnGoalStudio/XXTouchElite/tree/main" ;
15+ if ( params . locale == "en" ) {
16+ return ` ${ rootPath } / ${ params . versionDocsDirPath } / ${ params . docPath } ` ;
1717 }
18+ return `${ rootPath } /i18n/${ params . locale } /docusaurus-plugin-content-docs/current/${ params . docPath } ` ;
19+ }
20+
21+ function getBlogEditUrl ( params : { blogDirPath : string , blogPath : string , permalink : string , locale : string } ) {
22+ const rootPath = "https://github.com/OwnGoalStudio/XXTouchElite/tree/main" ;
23+ if ( params . locale == "en" ) {
24+ return `${ rootPath } /${ params . blogDirPath } /${ params . blogPath } ` ;
25+ }
26+ return `${ rootPath } /i18n/${ params . locale } /docusaurus-plugin-content-blog/${ params . blogPath } ` ;
27+ }
28+
29+ function getPagesEditUrl ( params : { pagesDirPath : string , pagesPath : string , permalink : string , locale : string } ) {
30+ const rootPath = "https://github.com/OwnGoalStudio/XXTouchElite/tree/main" ;
31+ if ( params . locale == "en" ) {
32+ return `${ rootPath } /${ params . pagesDirPath } /${ params . pagesPath } ` ;
33+ }
34+ return `${ rootPath } /i18n/${ params . locale } /docusaurus-plugin-content-pages/${ params . pagesPath } ` ;
1835}
1936
2037const config : Config = {
@@ -60,7 +77,7 @@ const config: Config = {
6077 showLastUpdateTime : true ,
6178 // Please change this to your repo.
6279 // Remove this to remove the "edit this page" links.
63- editUrl : getEditUrl ( 'docs' ) ,
80+ editUrl : getEditUrl ,
6481 } ,
6582 blog : {
6683 showReadingTime : true ,
@@ -71,12 +88,16 @@ const config: Config = {
7188 } ,
7289 // Please change this to your repo.
7390 // Remove this to remove the "edit this page" links.
74- editUrl : getEditUrl ( 'blog' ) ,
91+ editUrl : getBlogEditUrl ,
7592 // Useful options to enforce blogging best practices
7693 onInlineTags : 'ignore' ,
7794 onInlineAuthors : 'warn' ,
7895 onUntruncatedBlogPosts : 'warn' ,
7996 } ,
97+ pages : {
98+ showLastUpdateTime : true ,
99+ editUrl : getPagesEditUrl ,
100+ } ,
80101 theme : {
81102 customCss : './src/css/custom.css' ,
82103 } ,
0 commit comments