Skip to content

Commit

Permalink
Merge pull request #2773 from newrelic/alec/update-frontmatter
Browse files Browse the repository at this point in the history
fix: update frontmatter after translation
  • Loading branch information
aswanson-nr committed Jun 21, 2021
2 parents ec13739 + f2a2d15 commit 81d7cff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/actions/utils/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ module.exports = {
frontmatter: {
deserialize: (h, node) => {
const data = deserializeJSValue(node.properties.dataValue);
const frontMatterAtt = node.children.reduce((acc, child) => {
const key = child.properties.dataKey;
const value = child.children[0].value;
return { ...acc, [key]: value };
}, {});

return h(
node,
'yaml',
yaml.safeDump(data, { lineWidth: Infinity }).trim()
yaml
.safeDump({ ...data, ...frontMatterAtt }, { lineWidth: Infinity })
.trim()
);
},
serialize: (h, node) => {
Expand Down

0 comments on commit 81d7cff

Please sign in to comment.