From 6da22dcf215031281c268d1268bf84db157ba94e Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Tue, 18 Feb 2014 17:34:41 +0100 Subject: [PATCH] Support for other Analytics code --- bb.sh | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/bb.sh b/bb.sh index 665622f..7269cf5 100755 --- a/bb.sh +++ b/bb.sh @@ -64,6 +64,7 @@ # ######################################################################################### # +# 2.0.3 Support for other analytics code, via external file # 2.0.2 Fixed bug when $body_begin_file was empty # Added extra line in the footer linking to the github project # 2.0.1 Allow personalized header/footer files @@ -109,7 +110,7 @@ global_config=".config" # by the 'global_config' file contents global_variables() { global_software_name="BashBlog" - global_software_version="2.0.2" + global_software_version="2.0.3" # Blog title global_title="My fancy blog" @@ -128,9 +129,12 @@ global_variables() { # CC by-nc-nd is a good starting point, you can change this to "©" for Copyright global_license="CC by-nc-nd" - # If you have a Google Analytics ID (UA-XXXXX), put it here. - # If left empty (i.e. "") Analytics will be disabled + # If you have a Google Analytics ID (UA-XXXXX) and wish to use the standard + # embedding code, put it on global_analytics + # If you have custom analytics code (i.e. non-google) or want to use the Universal + # code, leave global_analytics empty and specify a global_analytics_file global_analytics="" + global_analytics_file="" # Leave this empty (i.e. "") if you don't want to use feedburner, # or change it to your own URL @@ -231,21 +235,25 @@ markdown() { # Prints the required google analytics code google_analytics() { - [[ -z "$global_analytics" ]] && return + [[ -z "$global_analytics" ]] && [[ -z "$global_analytics_file" ]] && return - echo "" + " + else + cat "$global_analytics_file" + fi } # Prints the required code for disqus comments @@ -712,7 +720,7 @@ rebuild_all_entries() { echo -n "Rebuilding all entries " for i in *.html; do # no need to sort - if [[ "$i" == "$index_file" ]] || [[ "$i" == "$archive_index" ]] || [[ "$i" == "$footer_file" ]] || [[ "$i" == "$header_file" ]]; then continue; fi + if [[ "$i" == "$index_file" ]] || [[ "$i" == "$archive_index" ]] || [[ "$i" == "$footer_file" ]] || [[ "$i" == "$header_file" ]] || [[ "$i" == "global_analytics_file" ]]; then continue; fi contentfile=".tmp.$RANDOM" while [ -f "$contentfile" ]; do contentfile=".tmp.$RANDOM"; done