Skip to content

Instantly share code, notes, and snippets.

@HackingGate
Last active September 27, 2015 05:11
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 HackingGate/40d9ec617dec78b73866 to your computer and use it in GitHub Desktop.
Save HackingGate/40d9ec617dec78b73866 to your computer and use it in GitHub Desktop.
A script to use buster generate static ghost website and fix something..
#!/bin/bash
LOCALHOST=http://localhost:2368
URL=http://hackinggate.com
LOCALDOMAIN=localhost:2368
DOMAIN=hackinggate.com
buster generate --domain=$LOCALHOST
#get rss & sitemap
wget -O- http://127.0.0.1:2368/rss/ > ./static/rss/index.html
wget -O- http://127.0.0.1:2368/sitemap.xml > ./static/sitemap.xml
wget -O- http://127.0.0.1:2368/sitemap.xsl > ./static/sitemap.xsl
wget -O- http://127.0.0.1:2368/sitemap-pages.xml > ./static/sitemap-pages.xml
wget -O- http://127.0.0.1:2368/sitemap-posts.xml > ./static/sitemap-posts.xml
wget -O- http://127.0.0.1:2368/sitemap-authors.xml > ./static/sitemap-authors.xml
wget -O- http://127.0.0.1:2368/sitemap-tags.xml > ./static/sitemap-tags.xml
#fix rss
find static/* -name *.rss -type f -exec sed -i '' 's#link>'$LOCALHOST'#link>'$URL'#g' {} \;
find static/* -name *.rss -type f -exec sed -i '' 's#href="'$LOCALHOST'#href="'$URL'#g' {} \;
#fix robots
find static/* -name *robots.txt -type f -exec sed -i '' 's#'$LOCALDOMAIN'#'$DOMAIN'#g' {} \;
#fix sitemap
find static/* -name *.xml -type f -exec sed -i '' 's#<loc>'$LOCALHOST'#<loc>'$URL'#g' {} \;
find static/* -name *.xsl -type f -exec sed -i '' 's#<sitemap><loc>'$LOCALHOST'#<sitemap><loc>'$URL'#g' {} \;
find static/* -name *.xsl -type f -exec sed -i '' 's#href="'$LOCALHOST'#href="'$URL'#g' {} \;
find static/* -name *.xml -type f -exec sed -i '' 's#'$LOCALDOMAIN'#'$DOMAIN'#g' {} \;
#fix link
find static/* -name *.html -type f -exec sed -i '' 's#"url": "'$LOCALHOST'#"url": "'$URL'#g' {} \;
find static/* -name *.html -type f -exec sed -i '' 's#link>'$LOCALHOST'#link>'$URL'#g' {} \;
find static/* -name *.html -type f -exec sed -i '' 's#content="'$LOCALHOST'#content="'$URL'#g' {} \;
find static/* -name *.html -type f -exec sed -i '' 's#href="'$LOCALHOST'#href="'$URL'#g' {} \;
find static/* -name *.html -type f -exec sed -i '' 's#href="http://netdna.bootstrapcdn.com#href="//netdna.bootstrapcdn.com#g' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment