Created
January 17, 2021 12:49
-
-
Save tanakaworld/519a3794d056cbc45d281ff1aa25c121 to your computer and use it in GitHub Desktop.
Convert posts of hexo to hugo.
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
# Dependencies | |
# - brew install gnu-sed | |
FILES='content/posts/*.md' | |
prefix='[[:digit:]][[:digit:]][[:digit:]][[:digit:]]-[[:digit:]][[:digit:]]-[[:digit:]][[:digit:]]-' | |
suffix='.md' | |
for f in $FILES | |
do | |
# Insert slug from file name | |
r=$(basename $f) | |
r=$(echo $r | sed -e "s/^$prefix//" -e "s/$suffix$//") | |
echo "slug: $r" | |
gsed -i "3islug: $r" $f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment