about summary refs log tree commit diff
path: root/add-front-matter.sh
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2021-05-08 22:12:40 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2021-05-08 22:12:40 +0700
commitcfe47619942f4416878ce3680eb09d28fcddadc4 (patch)
tree68fa3665beaa504d9e724637ed588b85cc1edcaf /add-front-matter.sh
parentbd920f04cc5c274d9cd76e420b88a567b5c1aec9 (diff)
downloadblog-cfe47619942f4416878ce3680eb09d28fcddadc4.tar.gz
Use hugo for generating markdown
Diffstat (limited to 'add-front-matter.sh')
-rwxr-xr-xadd-front-matter.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/add-front-matter.sh b/add-front-matter.sh
new file mode 100755
index 0000000..69e0b7b
--- /dev/null
+++ b/add-front-matter.sh
@@ -0,0 +1,19 @@
+if [[ $1 == "temp" ]]; then
+  exit
+fi
+
+title=$(grep -m1 '#' $1 | grep -o "[^#]*");
+new_path=$(echo $1 | sed "s/\//_/g"  | sed "s/\._/.\//g")
+
+{ echo -e "---\ntitle: $title";
+echo -e "categories: [ conlang ]";
+echo -e "no_feed: true";
+echo -e "disable_feed: true\n---\n";
+echo "Go to [Table of Contents](/conlang/)"
+cat $1; } > temp
+mv temp $1
+# flatten
+if [[ $1 != "./_index.md" ]]; then
+  mv $1 $new_path
+fi
+find -type d | grep "\./[a-z]*$" | rm -rf