diff --git a/public/css/global.css b/public/css/global.css
index fec7533..30c5620 100644
--- a/public/css/global.css
+++ b/public/css/global.css
@@ -51,7 +51,7 @@
--c-primary: rgb(255, 180, 180);
--c-pink: #374259;
--c-link: #0284c7;
- --c-border-1: #9090r0;
+ --c-border-1: #909090;
--c-nav-bg: rgb(255, 247, 255, 0.5);
--c-secondary: rgba(255, 255, 240, 0.5);
diff --git a/src/components/ApiLayout/Sidebar.astro b/src/components/ApiLayout/Sidebar.astro
new file mode 100644
index 0000000..02adf14
--- /dev/null
+++ b/src/components/ApiLayout/Sidebar.astro
@@ -0,0 +1,43 @@
+---
+import type { Hierarchy, Post } from "../../layouts/ApiLayout.astro";
+
+const hierarchy: Hierarchy = Astro.props.hierarchy;
+
+function splitAndLast(s: string): string {
+ const segments = s.split("/");
+ return segments[segments.length - 1]!;
+}
+
+function postComparison(a: Post, b: Post): number {
+ const s1 = splitAndLast(a.url);
+ const s2 = splitAndLast(b.url);
+
+ return s1 > s2 ? 0 : 1;
+}
+---
+
+{
+ Object.entries(hierarchy.children).map(([folderName, children]) => (
+ <>
+
+ {folderName}
+
+
+
+ >
+ ))
+}
+{
+ hierarchy.posts.sort(postComparison).map((p) => (
+
+ {splitAndLast(p.url)}
+
+ ))
+}
diff --git a/src/layouts/ApiLayout.astro b/src/layouts/ApiLayout.astro
index 74ca91d..f165128 100644
--- a/src/layouts/ApiLayout.astro
+++ b/src/layouts/ApiLayout.astro
@@ -2,8 +2,78 @@
import Navbar from "../components/Navbar.astro";
import BaseLayout from "./BaseLayout.astro";
import TOC from "../components/TOC.astro";
+import Sidebar from "../components/ApiLayout/Sidebar.astro";
const { headings } = Astro.props;
+
+export type Post = {
+ frontmatter: any;
+ getHeadings: any;
+ url: string;
+ file: any;
+ Content: any;
+ default: any;
+};
+type Posts = Array>;
+
+const basePath = "/api/std";
+const posts: Posts = await Astro.glob("../pages/api/std/**/*.{md,mdx}");
+
+export type Hierarchy = {
+ posts: Array;
+ children: Record;
+};
+
+function createHierarchy(posts: Posts): Hierarchy {
+ const hierarchy: Hierarchy = {
+ posts: [],
+ children: {},
+ };
+
+ for (const post of posts) {
+ const postUrl: string = post.url;
+ const urlAfterBase = postUrl.split(basePath)[1] ?? "";
+
+ // handle / (index)
+ if (urlAfterBase === "") {
+ hierarchy.posts.push(post);
+ continue;
+ }
+
+ const urlSegments = urlAfterBase.split("/").slice(1);
+
+ // top level urls
+ if (urlSegments.length === 1) {
+ hierarchy.posts.push(post);
+ continue;
+ }
+
+ // folders
+ const folders = urlSegments.slice(0, -1);
+
+ // traverse the hierarchy until the neccesary hierarchy is found
+ let currentHierarchy = hierarchy;
+ for (const folderName of folders) {
+ // check if folder exists, create otherwise
+ if (!hierarchy.children[folderName]) {
+ // create if doesnt exist
+ hierarchy.children[folderName] = {
+ posts: [],
+ children: {},
+ };
+ }
+
+ currentHierarchy = hierarchy.children[folderName];
+ }
+
+ // add the page
+ currentHierarchy.posts.push(post);
+ }
+
+ return hierarchy;
+}
+
+const hierarchy = createHierarchy(posts);
---
@@ -16,7 +86,7 @@ const { headings } = Astro.props;
border-c-border-1 -translate-x-64 lg:translate-x-0 transition-transform"
>
@@ -39,4 +109,10 @@ const { headings } = Astro.props;
+
+
diff --git a/src/layouts/PagesLayout.astro b/src/layouts/PagesLayout.astro
index 6a7cdf9..c7cc238 100644
--- a/src/layouts/PagesLayout.astro
+++ b/src/layouts/PagesLayout.astro
@@ -77,7 +77,9 @@ for (const entry of pagesIndex) {
-