Skip to content

Commit 99e4148

Browse files
committed
Move to .mdx files.
1 parent 44d4374 commit 99e4148

File tree

25 files changed

+39
-443
lines changed

25 files changed

+39
-443
lines changed

app/api/docs/search-index/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function findMarkdownFiles(dir: string): string[] {
1212
const fullPath = path.join(dir, entry.name);
1313
if (entry.isDirectory()) {
1414
files.push(...findMarkdownFiles(fullPath));
15-
} else if (entry.isFile() && entry.name.endsWith(".md")) {
15+
} else if (entry.isFile() && entry.name.endsWith(".mdx")) {
1616
files.push(fullPath);
1717
}
1818
}
@@ -29,7 +29,7 @@ function generateSearchIndex() {
2929
const content = fs.readFileSync(file, "utf8");
3030
const { data, content: markdownContent } = matter(content);
3131
const relativePath = path.relative(docsDir, file);
32-
const urlPath = `/docs/${relativePath.replace(/\.md$/, "")}`;
32+
const urlPath = `/docs/${relativePath.replace(/\.mdx$/, "")}`;
3333

3434
const excerpt = markdownContent
3535
.replace(/[#*`_~]/g, "")
@@ -38,7 +38,7 @@ function generateSearchIndex() {
3838
.substring(0, 150);
3939

4040
searchIndex.push({
41-
title: data.title || path.basename(file, ".md"),
41+
title: data.title || path.basename(file, ".mdx"),
4242
path: urlPath,
4343
excerpt,
4444
});

app/docs/[...slug]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { EditOnGitHub } from "@/components/docs/content/EditOnGitHub";
1313
import { ErrorBoundary } from "@/components/docs/content/ErrorBoundary";
1414
import { ReadingTime } from "@/components/docs/content/ReadingTime";
1515
import { ShortLink } from "@/components/docs/content/ShortLink";
16-
import { docsStructure } from "@/components/docs/sidebar/sidebar-structure";
16+
import { docsStructure } from "@/lib/sidebar-structure";
1717
import { components, mdxOptions } from "@/components/mdx/mdx-components";
1818

1919
interface DocMeta {
@@ -68,7 +68,7 @@ function getFlatDocs(): { title: string; path: string }[] {
6868

6969
async function getDocBySlug(slug: string[]): Promise<Doc | null> {
7070
const docsDirectory = path.join(process.cwd(), "content/docs");
71-
const fullPath = path.join(docsDirectory, slug.join("/") + ".md");
71+
const fullPath = path.join(docsDirectory, slug.join("/") + ".mdx");
7272

7373
try {
7474
const fileContents = await fs.readFile(fullPath, "utf8");

app/docs/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { redirect } from "next/navigation";
22

3-
import { docsStructure } from "@/components/docs/sidebar/sidebar-structure";
3+
import { docsStructure } from "@/lib/sidebar-structure";
44

55
function flattenDocs(structure: typeof docsStructure) {
66
return structure.flatMap(item =>

components/docs/content/EditOnGitHub.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface EditOnGitHubProps {
99
}
1010

1111
export const EditOnGitHub = ({ filePath, className }: EditOnGitHubProps) => {
12-
const githubUrl = `https://github.com/EternalCodeTeam/website/edit/main/content/docs/${filePath}.md`;
12+
const githubUrl = `https://github.com/EternalCodeTeam/website/edit/main/content/docs/${filePath}.mdx`;
1313

1414
return (
1515
<Link href={githubUrl} target="_blank" rel="noopener noreferrer">

components/docs/sidebar/DocSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import React, { useEffect } from "react";
66

77
import { cn } from "@/lib/utils";
88

9-
import { docsStructure } from "./sidebar-structure";
9+
import { docsStructure } from "../../../lib/sidebar-structure";
1010
import SidebarItem from "./SidebarItem";
1111
import { DocSidebarProps } from "./types";
1212
import { useMobileSidebar } from './useMobileSidebar';

components/mdx/mdx-components.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const components: MDXComponents = {
5656
),
5757

5858
// Custom components
59-
Alert: AlertBox,
59+
AlertBox: AlertBox,
6060
CodeTabs,
6161
CodeTab,
6262
DynamicCommandsTable,
File renamed without changes.

content/docs/documentation-editors/documentation-style-guide.md

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)