Skip to content

Instantly share code, notes, and snippets.

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 bugsysop/2b8ab4628e1cd9f8ebdced4a38f9574f to your computer and use it in GitHub Desktop.
Save bugsysop/2b8ab4628e1cd9f8ebdced4a38f9574f to your computer and use it in GitHub Desktop.
This script takes a folder with image files and converts them to page bundles to be used with gohugo.io
for file in *
do
date=`cut -d' ' -f 1 <<< "$file"`
dir=${file%".jpg"}
mkdir "$dir"
mv "$file" "$dir"
time=`cut -d' ' -f 2 <<< "$file" | sed -e 's/\./\:/g'`
datetime=$date'T'$time'+00:00'
printf '%s\n' '---' 'categories: ["instagram"]' "date: $datetime" 'description: ""' 'draft: false' 'resources:' " - src: '$file'" ' name: "header"' 'layout: instagram' 'slug:' 'stories:' 'subtitle:' 'title: Untitled' 'options:' ' unlisted: false' ' showHeader: true' '---' '' "<img src=\"$file\" />" | tee $dir/index.md $dir/index.pt.md
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment