This commit is contained in:
Stavros kois
2024-05-12 23:14:54 +03:00
parent 584a87852c
commit 838b836e2b
+2 -4
View File
@@ -23,8 +23,7 @@ is_true() {
}
# if file is empty
content=$(cat "$file_path")
if [ -z "$content" ]; then
if [ -z "$(cat "$file_path")" ]; then
echo -e "---\n" >"$file_path"
echo -e "---\n" >>"$file_path"
fi
@@ -32,9 +31,8 @@ fi
echo "Checking front matter"
if ! grep -q "^---$" "$file_path"; then
echo "Front matter (start) not found, adding it"
content=$(cat "$file_path")
echo -e "---\n" >"$file_path"
echo "$content" >>"$file_path"
echo "$(cat "$file_path")" >>"$file_path"
fi
# Get the title from the front matter