update
This commit is contained in:
@@ -3,7 +3,6 @@ import { defineCollection, z } from 'astro:content';
|
||||
import { glob, file } from 'astro/loaders'; // 不适用于旧版 API
|
||||
|
||||
const docs = defineCollection({
|
||||
// loader: glob({ pattern: '**/*.md', base: './src/data/blogs' }),
|
||||
loader: glob({ pattern: '**/[^_]*.md', base: './src/data/docs' }),
|
||||
schema: z.object({
|
||||
title: z.string().optional(),
|
||||
@@ -17,6 +16,7 @@ const docs = defineCollection({
|
||||
* 在侧边栏隐藏该文档
|
||||
*/
|
||||
hideInMenu: z.boolean().optional().default(false),
|
||||
order: z.number().optional().default(0),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ const {
|
||||
{
|
||||
showMenu && (
|
||||
<aside class='w-64 min-w-64 h-full flex flex-col'>
|
||||
<Menu items={menu!} client:only basename={basename} />
|
||||
<slot name='menu'>
|
||||
<Menu items={menu!} client:only basename={basename} />
|
||||
</slot>
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ type Post = {
|
||||
// 2. 对于你的模板,你可以直接从 prop 获取条目
|
||||
const { post } = Astro.props as { post: Post };
|
||||
const { Content } = await render(post);
|
||||
console.log('post', post);
|
||||
const showMenu = post.data?.showMenu;
|
||||
const staticPaths = await getStaticPaths();
|
||||
const menu = staticPaths.map((item) => item.data);
|
||||
@@ -25,7 +24,4 @@ const menu = staticPaths.map((item) => item.data);
|
||||
|
||||
<Main showMenu={showMenu} menu={menu} basename={basename}>
|
||||
<Content />
|
||||
<div slot='menu'>
|
||||
<div>sdfsdfsdf sfsdfsdf</div>
|
||||
</div>
|
||||
</Main>
|
||||
|
||||
Reference in New Issue
Block a user