Add frontmatter security

This commit is contained in:
Peaceultime 2024-01-08 22:25:45 +01:00
parent 8c41ac4f47
commit e74b186413
1 changed files with 10 additions and 0 deletions

View File

@ -179,6 +179,16 @@ export default function ofm() {
}
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)) {
file.data.frontmatter.tags.push(tag)
}