diff --git a/README.md b/README.md index b22a6fe..0277675 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Download bb.sh into a public folder of yours and run it: This will show the available commands +Before creating a blog post, edit bb.sh and modify the variables in the global_variables() function + To create your first post, just do: ./bb.sh post diff --git a/bb.sh b/bb.sh index d4e1ac2..f745ce4 100755 --- a/bb.sh +++ b/bb.sh @@ -32,10 +32,6 @@ # There are many loops which iterate on '*.html' so make sure that the only html files # on this folder are the blog entries and index.html and all_posts.html. Drafts must go # into drafts/ and any other *.html file should be moved out of the way -# -# TODO instead of using a file for $content, use a variable to avoid disk writes -# TODO enclose all variables with quotes (thanks Durad) -# TODO use a tag for dates, and keep them in sync with the html files (thanks Durad) ######################################################################################### @@ -64,6 +60,8 @@ # ######################################################################################### # +# 1.5 Durad Radojicic refactored some code and added flexibility +# 1.4.2 Now issues are handled at Github # 1.4.1 Some code refactoring # 1.4 Using twitter for comments, improved 'rebuild' command # 1.3 'edit' command @@ -87,57 +85,81 @@ # Global variables # It is recommended to perform a 'rebuild' after changing any of this in the code global_variables() { - # If you want to fork the project please contact me first, I wouldn't mind opening a git - # or some shared code base and collaborate with other people. - global_software_name="BashBlog" - global_software_version="1.4.1" + # If you want to fork the project please contact me first, I wouldn't mind opening a git + # or some shared code base and collaborate with other people. + global_software_name="BashBlog" + global_software_version="1.5" - # Blog title - global_title="Waiting for the jobs to finish" - # The typical subtitle for each blog - global_description="Thoughts on science and tips for researchers who use computers" - # The public base URL for this blog - global_url="http://mmb.pcb.ub.es/~carlesfe/blog" - - # Your name - global_author="Carles Fenollosa" - # You can use twitter or facebook or anything for global_author_url - global_author_url="http://mmb.pcb.ub.es/~carlesfe" - # Your email - global_email="carles.fenollosa@bsc.es" - - # 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, put it here. - # If left empty (i.e. "") Analytics will be disabled - global_analytics="UA-752819-13" - - # Leave this empty (i.e. "") if you don't want to use feedburner, - # or change it to your own URL - global_feedburner="http://feeds.feedburner.com/WaitingForTheJobsToFinish" + # Blog title + global_title="My blog" + # The typical subtitle for each blog + global_description="A blog where I talk about stuff" + # The public base URL for this blog + global_url="http://example.com/blog" - # Leave these empty if you don't want to use twitter for comments - global_twitter="true" - global_twitter_username="cfenollosa" + # blog generated files + # index page of blog (it is usually good to use "index.html" here) + index_file="index.html" + number_of_index_articles="8" + # global archive + archive_index="all_posts.html" + # feed file (rss in this case) + blog_feed="test.rss" + number_of_feed_articles="10" + + # template elements that can be translated + # "Comments?" (used in twitter link after every post) + template_comments="Comments?" + # "View more posts" (used on bottom of index page as link to archive) + template_archive="View more posts" + # "Back to the index page" (used on archive page, it is link to blog index) + template_archive_index_page="Back to the index page" + # "Subscribe" (used on bottom of index page, it is link to RSS feed) + template_subscribe="Subscribe" + # "Subscribe to this page..." (used as text for browser feed button that is embedded to html) + template_subscribe_browser_button="Subscribe to this page..." + # "Tweet" (used as twitter text button for posting to twitter) + template_twitter_button="Tweet" + + # Your name + global_author="John Smith" + # You can use twitter or facebook or anything for global_author_url + global_author_url="http://johnsmith.com/about-me" + # Your email + global_email="johnsmith@example.com" + + # 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, put it here. + # If left empty (i.e. "") Analytics will be disabled + global_analytics="" + + # Leave this empty (i.e. "") if you don't want to use feedburner, + # or change it to your own URL + global_feedburner="http://feeds.feedburner.example.com/MyBlog" + + # Leave these empty if you don't want to use twitter for comments + global_twitter="true" + global_twitter_username="examplecom" } # Prints the required google analytics code google_analytics() { - if [ "$global_analytics" == "" ]; then return; fi + if [ "$global_analytics" == "" ]; then return; fi - echo "" } @@ -151,24 +173,24 @@ google_analytics() { # # $1 the file to edit edit() { - timestamp="`date -r $1 +'%Y%m%d%k%M'`" - $EDITOR $1 - touch -t $timestamp $1 + timestamp="$(date -r $1 +'%Y%m%d%k%M')" + $EDITOR "$1" + touch -t $timestamp "$1" } # Adds the code needed by the twitter button # # $1 the post URL twitter() { - echo "
Comments? " - echo "Tweet " - echo "
" + echo "$template_comments " + echo "$template_twitter_button " + echo "
" } # Adds all the bells and whistles to format the html page @@ -183,525 +205,394 @@ twitter() { # $4 title for the html header # $5 original blog timestamp create_html_page() { - content=$1 - filename=$2 - index=$3 - title=$4 - timestamp=$5 + content="$1" + filename="$2" + index="$3" + title="$4" + timestamp="$5" - # Create the actual blog post - # html, head - cat .header.html > $filename - echo "