-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3eaeecf
commit 2da0c36
Showing
8 changed files
with
649 additions
and
66 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import fs from "fs"; | ||
import matter from "gray-matter"; | ||
|
||
export default function getPostMetadata(basePath) { | ||
const folder = basePath + "/"; | ||
const files = fs.readdirSync(folder); | ||
const markdownPosts = files.filter((file) => file.endsWith(".md")); | ||
|
||
// get the file data | ||
const posts = markdownPosts.map((filename) => { | ||
const fileContents = fs.readFileSync(`${basePath}/${filename}`, "utf8"); | ||
const matterResult = matter(fileContents); | ||
return { | ||
title: matterResult.data.title, | ||
slug: filename.replace(".md", ""), | ||
}; | ||
}); | ||
return posts; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.active { | ||
font-weight: bold; | ||
color: #ff0000; /* Example color */ | ||
} |
Oops, something went wrong.