Skip to content

Commit

Permalink
move to mdx hook?
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Apr 11, 2024
1 parent 080b075 commit 421e5db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Nav from "components/Nav"
import "styles/tailwind.css"
import { getContentDirs } from "utils/contentDirs"

export default function RootLayout({ children }: { children: React.ReactNode }) {
getContentDirs()
return (
<html lang="en">
<body>
Expand Down
3 changes: 2 additions & 1 deletion hooks/useMdxContent.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { compile } from '@mdx-js/mdx'
import { client } from 'tina/__generated__/client'
import fs from 'fs'
import path, { parse } from 'path'
import matter from 'gray-matter';
import { parseMDX } from "@tinacms/mdx";
import { getContentDirs } from 'utils/contentDirs';

const DEV = process.env.NODE_ENV === 'development'

Expand All @@ -22,6 +22,7 @@ export const getMdxContent = async <T extends any>(contentType: keyof typeof cli
const r = await client.queries[contentType]({ relativePath })
return r
} else {
getContentDirs()
const filepath = path.join(process.cwd(), 'content', contentType, relativePath)
const mdxContent = fs.readFileSync(filepath, 'utf-8')
const frontMatter = matter(mdxContent)
Expand Down

0 comments on commit 421e5db

Please sign in to comment.