Skip to content

Commit 6842493

Browse files
committed
fix blog config with topics
1 parent fd22a7b commit 6842493

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

astro.config.mjs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,17 @@ export default defineConfig({
238238
{
239239
label: { en: 'References', 'zh-CN': '参考', es: 'Referencias' },
240240
id: 'references',
241-
link: '/references',
242-
icon: 'information',
241+
link: '/reference/cli',
242+
icon: 'document',
243243
items: [
244+
{
245+
label: 'Command Line Interface',
246+
translations: {
247+
'zh-CN': '命令行接口(CLI)',
248+
es: 'Interfaz de línea de comandos',
249+
},
250+
link: '/reference/cli/',
251+
},
244252
{
245253
label: 'Security',
246254
translations: {
@@ -250,14 +258,6 @@ export default defineConfig({
250258
collapsed: true,
251259
autogenerate: { directory: 'reference/acl' },
252260
},
253-
{
254-
label: 'Command Line Interface',
255-
translations: {
256-
'zh-CN': '命令行接口(CLI)',
257-
es: 'Interfaz de línea de comandos',
258-
},
259-
link: '/reference/cli/',
260-
},
261261
{
262262
label: 'Configuration',
263263
translations: {
@@ -304,12 +304,16 @@ export default defineConfig({
304304
},
305305
{
306306
label: 'Blog',
307+
id: 'blog',
307308
link: '/blog/',
308-
icon: 'information',
309+
icon: 'pen',
310+
// Empty item to instruct it that is is local files, not an external link
311+
// this is actually filled in through the topics dir for `blog` below
312+
items: [],
309313
},
310314
],
311315
{
312-
exclude: ['/blog', '/blog/**/*'],
316+
topics: { blog: ['/blog', '/blog/*', '/blog/**/*'] },
313317
}
314318
),
315319
starlightLinksValidator({

src/content/config.ts renamed to src/content.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { defineCollection } from 'astro:content';
22
import { i18nSchema, docsSchema } from '@astrojs/starlight/schema';
3-
// TODO fix docsSchema usage
4-
// import { docsSchema } from 'src/schemas/docsSchema';
53
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
4+
import { topicSchema } from 'starlight-sidebar-topics/schema';
65
import { blogSchema } from 'starlight-blog/schema';
76

87
export const collections = {
98
docs: defineCollection({
109
loader: docsLoader(),
1110
schema: docsSchema({
12-
extend: (context) => blogSchema(context),
11+
extend: (context) => blogSchema(context).merge(topicSchema),
1312
}),
1413
}),
1514
i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),

src/content/docs/404.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: '404'
3+
topic: guides # will show this sidebar
34
template: doc
45
editUrl: false
56
tableOfContents: false

0 commit comments

Comments
 (0)