-
Home
-
- Here I blog about whatever get my attention
-
+ <>
+
Here I blog about whatever get my attention
{posts.length > 0 ? (
{posts.map((post, i) => (
@@ -25,6 +27,6 @@ export default function () {
) : (
)}
-
+ >
);
}
diff --git a/app/routes/blog.tsx b/app/routes/blog.tsx
new file mode 100644
index 0000000..2827837
--- /dev/null
+++ b/app/routes/blog.tsx
@@ -0,0 +1,19 @@
+import { Link, Outlet } from "@remix-run/react";
+import { useMatch } from "~/hooks/useMatch";
+
+export default function () {
+ const { handle } = useMatch();
+ return (
+
+ {handle && (
+
+ {handle.text}
+
+ )}
+
+
+ );
+}
diff --git a/app/utils/posts.server.ts b/app/utils/posts.server.ts
index bbcd4d3..11b6335 100644
--- a/app/utils/posts.server.ts
+++ b/app/utils/posts.server.ts
@@ -3,8 +3,8 @@ import { readFile } from "fs/promises";
import { bundleMDX } from "mdx-bundler";
import codeHikeTheme from "shiki/themes/one-dark-pro.json";
-export const getMdxFile = async (path: string) => {
- const source = await readFile(path);
+export const getMdxFile = async (fileName: string) => {
+ const source = await readFile(`posts/${fileName}`);
return bundleMDX({
source: source.toString(),
mdxOptions() {
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 21f404d..aeb98b3 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -11,7 +11,7 @@ model Post {
id String @id @default(cuid())
title String
description String?
- path String
+ fileName String
isPublic Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
diff --git a/tsconfig.json b/tsconfig.json
index 7eeacdd..0f5ff80 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,7 +3,7 @@
"remix.env.d.ts",
"**/*.ts",
"**/*.tsx",
- "app/routes/blog_.$id.tsx"
+ "app/routes/blog.$id.tsx"
],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2019"],