Skip to content

Commit

Permalink
add ownMeta prop to node
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed May 5, 2020
1 parent 07ce2f0 commit 5752425
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/middleware/assignMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const applyMetaToFiles = createNodeMiddleware(async nodePayload => {
const { file, state } = nodePayload
const { metaParser } = state.treePayload

file.ownMeta = file.ownMeta || {}
if (file.isFile) {
const node = file.isLayout ? file.getParent() : file
node.meta = await metaParser.get(file.absolutePath)
node.ownMeta = JSON.parse(JSON.stringify(node.meta))
}
})

Expand Down
3 changes: 2 additions & 1 deletion lib/middleware/generateFileTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const generateFileTree = async (payload) => {
payload.tree = {
name: 'root',
filepath: '/',
root: true,
root: true,
ownMeta: {}
}

const { ignore, extensions, pages } = payload.options
Expand Down

0 comments on commit 5752425

Please sign in to comment.