Improve removal of bad links

This commit is contained in:
Bob Mottram 2017-12-30 23:33:13 +00:00
parent 2cbdc9edcb
commit d32c6d9499
1 changed files with 12 additions and 6 deletions

View File

@ -42,11 +42,19 @@ BLOG_EDITOR='pluma'
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
function remove_bad_blog_links {
find ./ -type f -name *.css -exec sed -i -e '/googleapi/d' {} \;
find ./ -type f -name *.scss -exec sed -i -e '/googleapi/d' {} \;
find ./ -type f -name *.html -exec sed -i -e '/googleapi/d' {} \;
find ./ -type f -name *.css -exec sed -i -e '/bootstrapcdn/d' {} \;
find ./ -type f -name *.scss -exec sed -i -e '/bootstrapcdn/d' {} \;
find ./ -type f -name *.html -exec sed -i -e '/bootstrapcdn/d' {} \;
}
function remove_bad_blog_links_from_theme {
current_theme=$1
cd $BLOG_PATH/themes/$current_theme
find ./ -type f -name *.css -exec sed -i -e '/fonts.googleapis.com/d' {} \;
find ./ -type f -name *.html -exec sed -i -e '/fonts.googleapis.com/d' {} \;
remove_bad_blog_links
}
function ipfs_publish {
@ -82,10 +90,8 @@ function regenerate_blog {
fi
make html
# remove any google fonts
cd $BLOG_PATH
find ./ -type f -name *.css -exec sed -i -e '/fonts.googleapis.com/d' {} \;
find ./ -type f -name *.html -exec sed -i -e '/fonts.googleapis.com/d' {} \;
remove_bad_blog_links
ipfs_publish
}
@ -213,7 +219,7 @@ function change_theme {
CHOSEN_THEME_INDEX=$((CHOSEN_THEME_INDEX - 1))
CHOSEN_THEME=${THEMES[$CHOSEN_THEME_INDEX]}
remove_bad_blog_links $CHOSEN_THEME
remove_bad_blog_links_from_theme $CHOSEN_THEME
if grep -q "THEME=" $BLOG_PATH/pelicanconf.py; then
sed -i "s|THEME=.*|THEME='themes/${CHOSEN_THEME}'|g" $BLOG_PATH/pelicanconf.py
else