1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-26 20:01:24 +01:00

node refactor

This commit is contained in:
Matthias Kretschmann 2018-09-09 21:20:19 +02:00
parent 4fc6639fbd
commit 1e6860d0f1
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -53,6 +53,13 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
fastExif
.read(node.absolutePath)
.then(exifData => {
generateExif(exifData, createNodeField, node)
})
.catch(() => null) // just silently fail when exif can't be extracted
}
}
const generateExif = (exifData, createNodeField, node) => {
const iso = exifData.exif.ISO || null
const model = exifData.image.Model || null
const fstop = exifData.exif.FNumber || null
@ -73,9 +80,6 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
exposure
}
})
})
.catch(() => null) // just silently fail when exif can't be extracted
}
}
exports.createPages = ({ graphql, actions }) => {
@ -115,7 +119,7 @@ exports.createPages = ({ graphql, actions }) => {
generateContent(createPage, posts)
// Generate Tag Pages
createTagPages(createPage, posts)
generateTagPages(createPage, posts)
resolve()
})
@ -149,7 +153,7 @@ const generateContent = (createPage, posts) => {
})
}
const createTagPages = (createPage, posts) => {
const generateTagPages = (createPage, posts) => {
const tagSet = new Set()
const tagMap = new Map()