Last active
December 18, 2020 20:12
-
-
Save brunoamaral/2ea6e005005bf5dbbfac37bdc4508a65 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
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
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