Skip to content

Instantly share code, notes, and snippets.

@rdebeasi
Created October 27, 2017 21:12
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 rdebeasi/6e9ae4c391a9ed89ea8903d28394b6d1 to your computer and use it in GitHub Desktop.
Save rdebeasi/6e9ae4c391a9ed89ea8903d28394b6d1 to your computer and use it in GitHub Desktop.
Convert Hugo posts to taxonomies
#!/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