Created
October 27, 2017 21:12
-
-
Save rdebeasi/6e9ae4c391a9ed89ea8903d28394b6d1 to your computer and use it in GitHub Desktop.
Convert Hugo posts to taxonomies
This file contains hidden or 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 | |
# Run this in the directory containing the content type that you'd like to move. | |
# This script moves each markdown file into a new directory of the same name and renames the file to _index.md. | |
# You'll also need to add the taxonomy to config.toml. | |
FILES=*.md | |
for file in $FILES | |
do | |
filename="${file%%.*}" | |
if [ "$filename" == "_index" ]; then | |
continue | |
fi | |
echo "Moving $filename..." | |
mkdir $filename | |
mv $filename.md $filename/_index.md | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment