mirror of
https://github.com/xHyroM/website.git
synced 2024-11-25 08:11:05 +01:00
refactor: move docs into docs/ root folder
This commit is contained in:
parent
134f0ce564
commit
3be55e7c81
8 changed files with 38 additions and 8 deletions
|
@ -48,6 +48,7 @@ export default defineConfig({
|
|||
resolve: {
|
||||
alias: {
|
||||
"~": resolve(__dirname, "./src"),
|
||||
"@docs": resolve(__dirname, "./docs"),
|
||||
"@pages": resolve(__dirname, "./src/pages"),
|
||||
"@assets": resolve(__dirname, "./src/assets"),
|
||||
"@scripts": resolve(__dirname, "./src/scripts"),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Experiments
|
||||
description: How to fetch experiments from the API
|
||||
layout: ../../../layouts/docs/ItemLayout.astro
|
||||
---
|
||||
|
||||
# Experiments
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Introduction
|
||||
description: Introduction to the Discord Experiments API
|
||||
layout: ../../../layouts/docs/ItemLayout.astro
|
||||
---
|
||||
|
||||
# Introduction
|
|
@ -34,7 +34,6 @@ const getLinkClasses = (link: Sidebar) => {
|
|||
/>
|
||||
</button>
|
||||
</div>
|
||||
<!--<nav aria-labelledby="grid-left" class="w-64 border-r p-4">-->
|
||||
<nav
|
||||
id="sidebar"
|
||||
aria-labelledby="grid-left"
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
---
|
||||
import TableOfContents from "./TableOfContents.astro";
|
||||
const { item } = Astro.props;
|
||||
|
||||
const headings = item.getHeadings();
|
||||
---
|
||||
|
||||
{
|
||||
item.headings.length > 1 && (
|
||||
headings.length > 1 && (
|
||||
<nav aria-labelledby="grid-right" class="invisible md:visible">
|
||||
<div class="px-8">
|
||||
<TableOfContents headings={item.headings} />
|
||||
<TableOfContents headings={headings} />
|
||||
</div>
|
||||
</nav>
|
||||
)
|
||||
|
|
|
@ -4,13 +4,13 @@ import RightSidebar from "@components/widgets/docs/RightSidebar.astro";
|
|||
import Navbar from "@components/widgets/Navbar.astro";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
|
||||
const item = Astro.props;
|
||||
const { item } = Astro.props;
|
||||
const currentPage = new URL(Astro.request.url).pathname;
|
||||
---
|
||||
|
||||
<Layout
|
||||
title={`Docs - ${item.content.title}`}
|
||||
description={item.content.description}
|
||||
title={`Docs - ${item.frontmatter.title}`}
|
||||
description={item.frontmatter.description}
|
||||
url={`https://xhyrom.dev${item.url}`}
|
||||
>
|
||||
<Navbar />
|
||||
|
|
29
src/pages/docs/[category]/[id].astro
Normal file
29
src/pages/docs/[category]/[id].astro
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import ItemLayout from "@layouts/docs/ItemLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const docs = await Astro.glob("@docs/**/*.md");
|
||||
|
||||
return docs.map((doc) => {
|
||||
const path = doc.file.split("/docs/")[1];
|
||||
const [categoryId, docId] = path.split("/");
|
||||
|
||||
return {
|
||||
params: {
|
||||
category: categoryId,
|
||||
id: docId.replace(".md", ""),
|
||||
},
|
||||
props: {
|
||||
...doc,
|
||||
url: `/docs/${categoryId}/${docId.replace(".md", "")}`,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const item = Astro.props;
|
||||
---
|
||||
|
||||
<ItemLayout item={item}>
|
||||
<div set:html={item.compiledContent()} />
|
||||
</ItemLayout>
|
|
@ -4,6 +4,7 @@
|
|||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["src/*"],
|
||||
"@docs/*": ["docs/*"],
|
||||
"@pages/*": ["src/pages/*"],
|
||||
"@assets/*": ["src/assets"],
|
||||
"@scripts/*": ["src/scripts"],
|
||||
|
|
Loading…
Reference in a new issue