diff --git a/bb.sh b/bb.sh index a8650a2..c28f2ee 100755 --- a/bb.sh +++ b/bb.sh @@ -24,16 +24,17 @@ # Files that this script generates: # - main.css (inherited from my web page) and blog.css (blog-specific stylesheet) # - one .html for each post +# - one tag_*.html file for each tag # - index.html (regenerated each run) -# - feed.rss (regenerated each run) -# - all_posts.html (regenerated each run) +# - feed.rss (idem) +# - all_posts.html (idem) +# - all_tags.html (idem) # - it also generates temporal files, which are removed afterwards # # It generates valid html and rss files, so keep care to use valid xhtml when editing a post # -# 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 +# There are many loops which iterate on '*.html' so make sure not to manually put other +# html files on this folder. # # Read more: https://github.com/cfenollosa/bashblog @@ -65,6 +66,7 @@ ######################################################################################### # # 2.1 Support for tags/categories +# 'delete' command # 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 @@ -154,6 +156,7 @@ global_variables() { number_of_index_articles="8" # global archive archive_index="all_posts.html" + tags_index="all_tags.html" # feed file (rss in this case) blog_feed="feed.rss" number_of_feed_articles="10" @@ -176,6 +179,8 @@ global_variables() { template_archive="View more posts" # "All posts" (title of archive page) template_archive_title="All posts" + # "All tags" + template_tags_title="All tags" # "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) @@ -341,7 +346,7 @@ twitter() { # Return 0 (bash return value 'true') if the input file is am index, feed, etc # or 1 (bash return value 'false') if it is a blogpost is_boilerplate_file() { - if [[ "$1" == "$index_file" ]] || [[ "$1" == "$archive_index" ]] || [[ "$1" == "$footer_file" ]] || [[ "$1" == "$header_file" ]] || [[ "$1" == "$global_analytics_file" ]] || [[ "$1" = "$prefix_tags"* ]] ; then return 0 + if [[ "$1" == "$index_file" ]] || [[ "$1" == "$archive_index" ]] || [[ "$1" == "$tags_index" ]] || [[ "$1" == "$footer_file" ]] || [[ "$1" == "$header_file" ]] || [[ "$1" == "$global_analytics_file" ]] || [[ "$1" = "$prefix_tags"* ]] ; then return 0 else return 1 fi } @@ -589,6 +594,32 @@ all_posts() { rm "$contentfile" } +# Create an index page with all the tags +all_tags() { + echo -n "Creating an index page with all the tags " + contentfile="$tags_index.$RANDOM" + while [ -f "$contentfile" ]; do + contentfile="$tags_index.$RANDOM" + done + + echo "