11import { defineConfig } from 'astro/config' ;
22import starlight from '@astrojs/starlight' ;
33import sitemap from '@astrojs/sitemap' ;
4- import starlightUtils from '@lorenzo_lewis/ starlight-utils ' ;
4+ import starlightSidebarTopics from 'starlight-sidebar-topics ' ;
55import starlightLinksValidator from 'starlight-links-validator' ;
66import starlightHeadingBadges from 'starlight-heading-badges' ;
77import starlightLlmsTxt from 'starlight-llms-txt' ;
@@ -36,7 +36,10 @@ if (process.env.VERCEL_ENV === 'production' && process.env.VERCEL_PROJECT_PRODUC
3636// https://astro.build/config
3737const config = defineConfig ( {
3838 site : site ,
39- trailingSlash : 'always' ,
39+ // 'ignore' works around an Astro 7 bug where 'always' breaks starlight-llms-txt's
40+ // extensioned `/_llms-txt/[slug].txt` route. Output is unchanged: the 'directory' build
41+ // format and Vercel (`trailingSlash: true`) keep URLs trailing-slashed regardless.
42+ trailingSlash : 'ignore' ,
4043 integrations : [
4144 starlight ( {
4245 title : 'Crowdin Docs' ,
@@ -47,33 +50,6 @@ const config = defineConfig({
4750 light : './src/assets/logo/dark.svg' ,
4851 dark : './src/assets/logo/light.svg' ,
4952 } ,
50- sidebar : [
51- {
52- label : 'Crowdin Help' ,
53- items : [ ...crowdinSidebar ] ,
54- } ,
55- {
56- label : 'Enterprise Help' ,
57- items : [ ...enterpriseSidebar ] ,
58- } ,
59- {
60- label : 'Developer Portal' ,
61- items : [ ...developerSidebar ] ,
62- } ,
63- // Navigation links
64- {
65- label : "leading" ,
66- items : [
67- { label : "Crowdin Help" , slug : "introduction" , attrs : { id : "crowdin-nav-button" , class : "nav-link" } } ,
68- { label : "Enterprise Help" , slug : "enterprise/introduction" , attrs : { id : "enterprise-nav-button" , class : "nav-link" } } ,
69- { label : "Developer Portal" , slug : "developer/crowdin-apps-about" , attrs : { id : "developer-nav-button" , class : "nav-link" } } ,
70- { label : "Store" , link : "https://store.crowdin.com" , attrs : { target : "_blank" , class : "nav-link" } } ,
71- { label : "Blog" , link : "https://crowdin.com/blog" , attrs : { target : "_blank" , class : "nav-link" } } ,
72- { label : "Community" , link : "https://community.crowdin.com/" , attrs : { target : "_blank" , class : "nav-link" } } ,
73- { label : "Crowdin.com" , link : "https://crowdin.com/" , attrs : { target : "_blank" , class : "nav-link" } } ,
74- ] ,
75- }
76- ] ,
7753 head : [
7854 // Custom consent mode https://www.cookieyes.com/documentation/implementing-google-consent-mode-using-cookieyes/
7955 {
@@ -136,6 +112,8 @@ const config = defineConfig({
136112 SocialIcons : './src/components/SocialIcons.astro' ,
137113 EditLink : './src/components/EditLink.astro' ,
138114 FallbackContentNotice : './src/components/FallbackContentNotice.astro' ,
115+ SiteTitle : './src/components/SiteTitle.astro' ,
116+ Sidebar : './src/components/Sidebar.astro' ,
139117 } ,
140118 customCss : [
141119 './src/style/global.css' ,
@@ -148,14 +126,39 @@ const config = defineConfig({
148126 baseUrl : 'https://github.com/crowdin/docs/edit/main' ,
149127 } ,
150128 plugins : [
151- starlightUtils ( {
152- multiSidebar : {
153- switcherStyle : "hidden" ,
129+ starlightSidebarTopics (
130+ [
131+ {
132+ label : 'hero.crowdinHelp' ,
133+ id : 'crowdin' ,
134+ link : '/introduction/' ,
135+ icon : 'open-book' ,
136+ items : [ ...crowdinSidebar ] ,
137+ } ,
138+ {
139+ label : 'hero.enterpriseHelp' ,
140+ id : 'enterprise' ,
141+ link : '/enterprise/introduction/' ,
142+ icon : 'information' ,
143+ items : [ ...enterpriseSidebar ] ,
144+ } ,
145+ {
146+ label : 'hero.developerPortal' ,
147+ id : 'developer' ,
148+ link : '/developer/crowdin-apps-about/' ,
149+ icon : 'puzzle' ,
150+ items : [ ...developerSidebar ] ,
151+ } ,
152+ ] ,
153+ {
154+ exclude : [
155+ '/ai-fine-tuning' ,
156+ '/enterprise/ai-fine-tuning' ,
157+ '/*/ai-fine-tuning' ,
158+ '/*/enterprise/ai-fine-tuning' ,
159+ ] ,
154160 } ,
155- navLinks : {
156- leading : { useSidebarLabelled : "leading" } ,
157- }
158- } ) ,
161+ ) ,
159162 starlightLinksValidator ( {
160163 errorOnFallbackPages : false ,
161164 errorOnInvalidHashes : false ,
@@ -286,15 +289,15 @@ const config = defineConfig({
286289 targets : [
287290 {
288291 src : 'src/scripts' ,
289- dest : 'src '
292+ dest : ''
290293 } ,
291294 {
292295 src : 'node_modules/redoc/bundles/redoc.standalone.js' ,
293- dest : 'node_modules/redoc/bundles '
296+ dest : ''
294297 } ,
295298 {
296299 src : 'src/assets/api' ,
297- dest : 'src/assets '
300+ dest : ''
298301 }
299302 ]
300303 } )
0 commit comments