Skip to content

Commit 5520a1b

Browse files
author
Sergei Orlov
committed
✨ Make frontmatter a bit more convenient to use
1 parent 58e916e commit 5520a1b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gatsby-node.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ exports.sourceNodes = async (
1818
pages.forEach((page) => {
1919
const title = getNotionPageTitle(page)
2020
const properties = getNotionPageProperties(page)
21+
const frontmatter = Object.keys(properties).reduce(
22+
(acc, key) => ({
23+
...acc,
24+
[key]: properties[key].value,
25+
}),
26+
{ title },
27+
)
2128
const markdown = "---\n"
22-
.concat(YAML.stringify({ title, ...properties }))
29+
.concat(YAML.stringify(frontmatter))
2330
.concat("\n---\n\n")
2431
.concat(getNotionPageMD(page))
2532

0 commit comments

Comments
 (0)