Add frontmatter security
This commit is contained in:
1 parent
8c41ac4f47
commit
e74b186413
1 file changed
+10
@@ -179,6 +179,16 @@ export default function ofm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tag = slugTag(tag)
|
tag = slugTag(tag)
|
||||||
|
|
||||||
|
if (!file.data)
|
||||||
|
file.data = {};
|
||||||
|
|
||||||
|
if (!file.data.frontmatter)
|
||||||
|
file.data.frontmatter = {};
|
||||||
|
|
||||||
|
if (!file.data.frontmatter.tags)
|
||||||
|
file.data.frontmatter.tags = [];
|
||||||
|
|
||||||
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
||||||
file.data.frontmatter.tags.push(tag)
|
file.data.frontmatter.tags.push(tag)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user