Skip to content

Instantly share code, notes, and snippets.

@yuhangch
Last active April 13, 2024 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuhangch/fe251512391a4f590c582ea2d566f16a to your computer and use it in GitHub Desktop.
Save yuhangch/fe251512391a4f590c582ea2d566f16a to your computer and use it in GitHub Desktop.
Make Hugo New Post More Effective (OS X Only)
#!/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
@yydschen
Copy link

这个如何使用?

@yuhangch
Copy link
Author

这个如何使用?

是很早之前的一个想法,目前来看更多是提供一个思路吧,通过命令行参数

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