From f6f8e8829f20115ff4d5665a7db6f0c6720cda2c Mon Sep 17 00:00:00 2001 From: Peter Ludikovsky Date: Tue, 16 Feb 2016 09:48:49 +0000 Subject: Added feature for static compression. Article generation now automatically compresses articles and feeds for use with web servers supporting it, eg. gzip_static on nginx. --- html-gen.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'html-gen.sh') diff --git a/html-gen.sh b/html-gen.sh index a98a1d7..406da7f 100644 --- a/html-gen.sh +++ b/html-gen.sh @@ -330,6 +330,9 @@ for f in $added_files $modified_files; do echo -n " $f... " generate_article "$f" echo "done." + echo -n "[fugitive] Generating $public_dir/${f#$articles_dir/}.html.gz... " + gzip -9k $public_dir/${f#$articles_dir/}.html + echo "done." echo "${f#$articles_dir/}" >> "$generated_files" fi done @@ -339,6 +342,7 @@ for f in $added_files; do art="${f#$articles_dir/}" echo -n "[fugitive] Adding $public_dir/$art.html to git ignore list... " echo "$public_dir/$art.html" >> .git/info/exclude + echo "$public_dir/$art.html.gz" >> .git/info/exclude echo "done." previous=`get_article_previous_file "$art"` next=`get_article_next_file "$art"` @@ -353,8 +357,12 @@ for f in $deleted_files; do echo -n "[fugitive] Deleting $public_dir/$art.html... " rm "$public_dir/$art.html" echo "done." + echo -n "[fugitive] Deleting $public_dir/$art.html.gz... " + rm "$public_dir/$art.html.gz" + echo "done." echo -n "[fugitive] Removing $art.html from git ignore list... " sed -i "/^$public_dir\/$art.html$/d" .git/info/exclude + sed -i "/^$public_dir\/$art.html.gz$/d" .git/info/exclude echo "done." previous=`get_deleted_previous_file "$art"` next=`get_deleted_next_file "$art"` @@ -376,6 +384,7 @@ if [ $modification -gt 0 ]; then replace_commit_info "-1" | \ sed "/^[[:space:]]*$/d" > "$temp" cp "$temp" "$public_dir/archives.html" + gzip -9k "$public_dir/archives.html" echo "done." echo -n "[fugitive] Generating $public_dir/rss.xml... " last_5_articles=`mktemp fugitiveXXXXXX` @@ -391,6 +400,7 @@ if [ $modification -gt 0 ]; then replace_commit_info "-1" | \ sed "/^[[:space:]]*$/d" > "$temp" cp "$temp" "$public_dir/rss.xml" + gzip -9k "$public_dir/rss.xml" echo "done." echo -n "[fugitive] Generating $public_dir/atom.xml... " last_5_articles=`mktemp fugitiveXXXXXX` @@ -406,10 +416,12 @@ if [ $modification -gt 0 ]; then replace_commit_info "-1" | \ sed "/^[[:space:]]*$/d" > "$temp" cp "$temp" "$public_dir/atom.xml" + gzip -9k "$public_dir/atom.xml" echo "done." rm "$last_5_articles" "$last_5_commits" "$temp" echo -n "[fugitive] Using last published article as index page... " cp "$public_dir/`head -1 $articles_sorted`.html" "$public_dir/index.html" + gzip -9k "$public_dir/index.html" echo "done". echo "[fugitive] Blog update complete." fi -- cgit v1.2.3