mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 12:16:53 +00:00
Update page.tsx
This commit is contained in:
parent
9d27944fbb
commit
82568dfa11
@ -4,7 +4,7 @@ import { remark } from "remark"
|
|||||||
import html from "remark-html"
|
import html from "remark-html"
|
||||||
|
|
||||||
async function getGuideContent(slug: string) {
|
async function getGuideContent(slug: string) {
|
||||||
const guidePath = path.join(process.cwd(), "guides", `${slug}.md`)
|
const guidePath = path.join(process.cwd(), "..", "..", "guides", `${slug}.md`)
|
||||||
const fileContents = fs.readFileSync(guidePath, "utf8")
|
const fileContents = fs.readFileSync(guidePath, "utf8")
|
||||||
|
|
||||||
const result = await remark().use(html).process(fileContents)
|
const result = await remark().use(html).process(fileContents)
|
||||||
@ -12,7 +12,8 @@ async function getGuideContent(slug: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
const guideFiles = fs.readdirSync(path.join(process.cwd(), "guides"))
|
const guidesPath = path.join(process.cwd(), "..", "..", "guides")
|
||||||
|
const guideFiles = fs.readdirSync(guidesPath)
|
||||||
return guideFiles.map((file) => ({
|
return guideFiles.map((file) => ({
|
||||||
slug: file.replace(/\.md$/, ""),
|
slug: file.replace(/\.md$/, ""),
|
||||||
}))
|
}))
|
||||||
@ -23,7 +24,7 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto px-4 py-16 max-w-3xl">
|
<div className="container mx-auto px-4 py-16 max-w-3xl">
|
||||||
<div className="prose prose-lg dark:prose-invert" dangerouslySetInnerHTML={{ __html: guideContent }} />
|
<div className="prose prose-lg" dangerouslySetInnerHTML={{ __html: guideContent }} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user