Skip to content

Commit

Permalink
Correct use of pageData
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Apr 9, 2016
1 parent 95da1db commit 0ce3be5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/utils/build-page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function buildPage (directory, page) {
const pageData = loadFrontmatter(page)

const relativePath = path.relative(path.join(directory, 'pages'), page)
const pathData = pathResolver(relativePath)
const pathData = pathResolver(relativePath, pageData)

return objectAssign({}, pageData, pathData)
return objectAssign({}, pathData, { data: pageData })
}
4 changes: 2 additions & 2 deletions lib/utils/build-page/path-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import slash from 'slash'
import parsePath from 'parse-filepath'
import urlResolver from './url-resolver'

export default function pathResolver (relativePath) {
export default function pathResolver (relativePath, pageData={}) {
const data = {}

data.file = parsePath(relativePath)
Expand All @@ -17,7 +17,7 @@ export default function pathResolver (relativePath) {

// set the URL path (should this be renamed)
// and now looking at it, it only needs a reference to pageData
data.path = urlResolver(data, data.file)
data.path = urlResolver(pageData, data.file)

// Set the "template path"
if (data.file.name === '_template') {
Expand Down

0 comments on commit 0ce3be5

Please sign in to comment.