feat: render sidebar without depth

This commit is contained in:
Araozu 2024-11-21 20:14:01 -05:00
parent 45cee168e6
commit eded324a43
3 changed files with 22 additions and 8 deletions

View File

@ -40,18 +40,18 @@ const {
const base_dir_end = base_dir.length;
const posts_2 = posts.map(post => ({
...post,
relative_file: post.file.substring(base_dir_end),
path: post.file.substring(base_dir_end),
title: post.frontmatter.title,
}))
const posts_2 = posts
.map(post => ({
...post,
relative_file: post.file.substring(base_dir_end),
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 basePath = index_page.url;
console.log(JSON.stringify(index_page, null, 4));
const pagesIndex = posts_2;
---

View 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

View File

@ -1,6 +1,7 @@
---
layout: "./_wrapper.astro"
title: Welcome
order: 1
---
import InteractiveCode from "@/components/InteractiveCode.astro";
import Code from "@/components/Code.astro"