diff options
author | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2021-05-08 22:12:40 +0700 |
---|---|---|
committer | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2021-05-08 22:12:40 +0700 |
commit | cfe47619942f4416878ce3680eb09d28fcddadc4 (patch) | |
tree | 68fa3665beaa504d9e724637ed588b85cc1edcaf /add-front-matter.sh | |
parent | bd920f04cc5c274d9cd76e420b88a567b5c1aec9 (diff) | |
download | blog-cfe47619942f4416878ce3680eb09d28fcddadc4.tar.gz |
Use hugo for generating markdown
Diffstat (limited to 'add-front-matter.sh')
-rwxr-xr-x | add-front-matter.sh | 19 |
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 |