Created
July 10, 2016 20:23
-
-
Save pirafrank/39f231552706f1c843a21df723d23c28 to your computer and use it in GitHub Desktop.
Script to 'jekyllfy' url images. Replaces your website url with {{site.baseurl}}. Useful when you want to preview your images in editor (iA Writer?) before committing markdown files to repo. sed command is compatible with OS X version of sed.
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
#!/bin/bash | |
if [[ $# != 1 ]]; then | |
echo "Error: you need to pass the path where markdown file are!" | |
echo "Usage: ./jekyllfy_image_urls.sh [path]" | |
exit 1 | |
fi | |
# changing urls... (this edit in place creating NO backup files!) | |
find "$1" -name "*.md" -exec sed -i '' 's#http://your.website.com#{{site.baseurl}}#g' {} \; | |
# if you want backup files, use the version below | |
#find "$1" -name "*.md" -exec sed -i.bkp 's#http://your.website.com#{{site.baseurl}}#g' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment