mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-07-06 15:36:53 +00:00
Update page.tsx
This commit is contained in:
parent
ec29e76dbb
commit
7affb5f4e8
@ -5,7 +5,8 @@ import html from "remark-html"
|
|||||||
|
|
||||||
// Function to retrieve the guide content based on the slug
|
// Function to retrieve the guide content based on the slug
|
||||||
async function getGuideContent(slug: string) {
|
async function getGuideContent(slug: string) {
|
||||||
const guidePath = path.join(process.cwd(), "guides", slug, "index.md") // Adjusted to look inside a folder
|
// Adjusted to look inside the correct 'guides' folder at the root level of the project
|
||||||
|
const guidePath = path.join(process.cwd(), "..", "guides", slug, "index.md") // Corrected to look in the root directory
|
||||||
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)
|
||||||
@ -14,7 +15,8 @@ async function getGuideContent(slug: string) {
|
|||||||
|
|
||||||
// Function to generate static paths for all available guides
|
// Function to generate static paths for all available guides
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
const guidesPath = path.join(process.cwd(), "guides")
|
// Adjusted to look in the correct 'guides' folder at the root level of the project
|
||||||
|
const guidesPath = path.join(process.cwd(), "..", "guides")
|
||||||
const guideFolders = fs.readdirSync(guidesPath, { withFileTypes: true }) // Read only directories
|
const guideFolders = fs.readdirSync(guidesPath, { withFileTypes: true }) // Read only directories
|
||||||
|
|
||||||
return guideFolders
|
return guideFolders
|
||||||
@ -34,5 +36,3 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user