11import { themes as prismThemes } from 'prism-react-renderer' ;
22import type { Config } from '@docusaurus/types' ;
33import type * as Preset from '@docusaurus/preset-classic' ;
4+ import type { Options as ClientRedirectsOptions } from '@docusaurus/plugin-client-redirects' ;
45
5- // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
6+ const defaultLocale = 'en' ;
67
78const config : Config = {
89 title : 'AI-Terminal' ,
@@ -43,10 +44,13 @@ const config: Config = {
4344 {
4445 docs : {
4546 sidebarPath : './sidebars.ts' ,
46- // Please change this to your repo.
4747 // Remove this to remove the "edit this page" links.
48- editUrl :
49- 'https://github.com/coding-hui/ai-terminal/tree/main/website/' ,
48+ // editUrl: 'https://github.com/coding-hui/ai-terminal/tree/main/website/',
49+ editUrl : ( { locale, docPath} ) => {
50+ return `https://github.com/coding-hui/ai-terminal/tree/main/website/docs/${ docPath } ` ;
51+ } ,
52+ showLastUpdateAuthor : true ,
53+ showLastUpdateTime : true ,
5054 } ,
5155 blog : {
5256 showReadingTime : true ,
@@ -56,8 +60,7 @@ const config: Config = {
5660 } ,
5761 // Please change this to your repo.
5862 // Remove this to remove the "edit this page" links.
59- editUrl :
60- 'https://github.com/coding-hui/ai-terminal/tree/main/website/' ,
63+ editUrl : 'https://github.com/coding-hui/ai-terminal/tree/main/website/' ,
6164 // Useful options to enforce blogging best practices
6265 onInlineTags : 'warn' ,
6366 onInlineAuthors : 'warn' ,
@@ -84,9 +87,9 @@ const config: Config = {
8487 } ,
8588 items : [
8689 {
87- type : 'docSidebar' ,
88- sidebarId : 'docsSidebar' ,
90+ type : 'doc' ,
8991 position : 'left' ,
92+ docId : 'intro' ,
9093 label : 'Documentation' ,
9194 } ,
9295 // {to: '/blog', label: 'Blog', position: 'left'},
@@ -147,6 +150,28 @@ const config: Config = {
147150 darkTheme : prismThemes . dracula ,
148151 } ,
149152 } satisfies Preset . ThemeConfig ,
153+
154+ plugins : [
155+ [
156+ 'client-redirects' ,
157+ {
158+ fromExtensions : [ 'html' ] ,
159+ createRedirects ( routePath ) {
160+ // Redirect to /docs from /docs/introduction (now docs root doc)
161+ if ( routePath === '/docs' || routePath === '/docs/' ) {
162+ return [ `${ routePath } /intro` ] ;
163+ }
164+ return [ ] ;
165+ } ,
166+ redirects : [
167+ {
168+ from : [ '/docs/support' , '/docs/next/support' ] ,
169+ to : '/community/support' ,
170+ } ,
171+ ] ,
172+ } satisfies ClientRedirectsOptions ,
173+ ]
174+ ]
150175} ;
151176
152177export default config ;
0 commit comments