feat: render sidebar without depth
This commit is contained in:
parent
45cee168e6
commit
eded324a43
@ -40,18 +40,18 @@ const {
|
|||||||
|
|
||||||
const base_dir_end = base_dir.length;
|
const base_dir_end = base_dir.length;
|
||||||
|
|
||||||
const posts_2 = posts.map(post => ({
|
const posts_2 = posts
|
||||||
...post,
|
.map(post => ({
|
||||||
relative_file: post.file.substring(base_dir_end),
|
...post,
|
||||||
path: post.file.substring(base_dir_end),
|
relative_file: post.file.substring(base_dir_end),
|
||||||
title: post.frontmatter.title,
|
path: post.file.substring(base_dir_end).replace(/\.mdx?$/, ""),
|
||||||
}))
|
title: post.frontmatter.title,
|
||||||
|
}))
|
||||||
|
.sort((p1, p2) => p1.frontmatter.order > p2.frontmatter.order? 1 : -1);
|
||||||
|
|
||||||
const index_page = posts_2.find(post => post.relative_file === "/index.md" || post.relative_file === "/index.mdx");
|
const index_page = posts_2.find(post => post.relative_file === "/index.md" || post.relative_file === "/index.mdx");
|
||||||
const basePath = index_page.url;
|
const basePath = index_page.url;
|
||||||
|
|
||||||
console.log(JSON.stringify(index_page, null, 4));
|
|
||||||
|
|
||||||
const pagesIndex = posts_2;
|
const pagesIndex = posts_2;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
13
src/pages/en/latest/learn/basics.mdx
Normal file
13
src/pages/en/latest/learn/basics.mdx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
layout: "./_wrapper.astro"
|
||||||
|
title: Basics
|
||||||
|
order: 2
|
||||||
|
---
|
||||||
|
import InteractiveCode from "@/components/InteractiveCode.astro";
|
||||||
|
import Code from "@/components/Code.astro"
|
||||||
|
|
||||||
|
# Hello!
|
||||||
|
|
||||||
|
Hi
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: "./_wrapper.astro"
|
layout: "./_wrapper.astro"
|
||||||
title: Welcome
|
title: Welcome
|
||||||
|
order: 1
|
||||||
---
|
---
|
||||||
import InteractiveCode from "@/components/InteractiveCode.astro";
|
import InteractiveCode from "@/components/InteractiveCode.astro";
|
||||||
import Code from "@/components/Code.astro"
|
import Code from "@/components/Code.astro"
|
||||||
|
Loading…
Reference in New Issue
Block a user