Created
August 3, 2021 16:32
-
-
Save mheadd/c8d9d5e3b7caad4398c12c54767670d1 to your computer and use it in GitHub Desktop.
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
const { batch } = require('frontmatter-file-batcher'); | |
// The name of the file to modify. | |
const file_name = process.argv[2]; | |
// The name of the new front matter property to add. | |
let fm_property = process.argv[3]; | |
// The value of the new front matter property | |
let fm_value = process.argv[4]; | |
batch(`content/${file_name}`, 1, async ({ goods, actions }) => { | |
const { update, save } = actions; | |
var data = {}; | |
data[fm_property] = { $set: fm_value }; | |
const newData = update({ data }); | |
await save(newData); | |
console.log('Just saved:', goods.path); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment