Last active
April 13, 2024 05:07
-
-
Save yuhangch/fe251512391a4f590c582ea2d566f16a to your computer and use it in GitHub Desktop.
Make Hugo New Post More Effective (OS X Only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ./hugox test-ok-dd title-of-post catalog | |
cd ~/repos/blog | |
zh=$2 | |
path=`hugo new posts/$1.md | cut -f1 -d" "` | |
echo $path | |
sed -i '' "s|\".*\"|\"${zh}\"|" $path | |
sed -i '' '5i\ | |
tags: [""] | |
' $path | |
sed -i '' "6i\\ | |
categories: [\"$3\"] | |
" $path | |
open -a typora $path | |
# code $path |
这个如何使用?
是很早之前的一个想法,目前来看更多是提供一个思路吧,通过命令行参数
hugox hello-world "你好,世界" share
创建一篇博文,并填充好标题和categories
后来发现使用hugo archetypes 更合适一些🤦♂️。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这个如何使用?