فهرست منبع

Support for static, not managed by bashblog html files. Close #92

Carlos Fenollosa 8 سال پیش
والد
کامیت
500253e2ad
2فایلهای تغییر یافته به همراه12 افزوده شده و 1 حذف شده
  1. 1 0
      README.md
  2. 11 1
      bb.sh

+ 1 - 0
README.md

@@ -135,6 +135,7 @@ Changelog
 - 2.8      Bugfixes
 - 2.8      Bugfixes
            Slavic language support thanks to Tomasz Jadowski
            Slavic language support thanks to Tomasz Jadowski
            Removed the now defunct Twitter JSON API share count
            Removed the now defunct Twitter JSON API share count
+           Support for static, not managed by bashblog html files
 - 2.7      Store post date on a comment in the html file (#96). 
 - 2.7      Store post date on a comment in the html file (#96). 
            On rebuild, the post date will be synchronised between comment date and file date, with precedence for comment date.
            On rebuild, the post date will be synchronised between comment date and file date, with precedence for comment date.
 - 2.6      Support for multiple authors, use a different `.config` for each one
 - 2.6      Support for multiple authors, use a different `.config` for each one

+ 11 - 1
bb.sh

@@ -66,6 +66,11 @@ global_variables() {
     # global archive
     # global archive
     archive_index="all_posts.html"
     archive_index="all_posts.html"
     tags_index="all_tags.html"
     tags_index="all_tags.html"
+
+    # Non blogpost files. Bashblog will ignore these. Useful for static pages and custom content
+    # Add them as a bash array, e.g. non_blogpost_files=("news.html" "test.html")
+    non_blogpost_files=()
+
     # feed file (rss in this case)
     # feed file (rss in this case)
     blog_feed="feed.rss"
     blog_feed="feed.rss"
     number_of_feed_articles="10"
     number_of_feed_articles="10"
@@ -376,6 +381,11 @@ twitter() {
 # or 1 (bash return value 'false') if it is a blogpost
 # or 1 (bash return value 'false') if it is a blogpost
 is_boilerplate_file() {
 is_boilerplate_file() {
     name=${1#./}
     name=${1#./}
+    # First check against user-defined non-blogpost pages
+    for item in "${non_blogpost_files[@]}"; do
+        [[ "$name" == "$item" ]] && return 0
+    done
+
     case $name in
     case $name in
     ( "$index_file" | "$archive_index" | "$tags_index" | "$footer_file" | "$header_file" | "$global_analytics_file" | "$prefix_tags"* )
     ( "$index_file" | "$archive_index" | "$tags_index" | "$footer_file" | "$header_file" | "$global_analytics_file" | "$prefix_tags"* )
         return 0 ;;
         return 0 ;;
@@ -682,7 +692,7 @@ all_tags() {
             case $nposts in
             case $nposts in
                 1) word=$template_tags_posts_singular;;
                 1) word=$template_tags_posts_singular;;
                 2|3|4) word=$template_tags_posts_2_4;;
                 2|3|4) word=$template_tags_posts_2_4;;
-                *) word=$template_tags_posts
+                *) word=$template_tags_posts;;
             esac
             esac
             echo "<li><a href=\"$i\">$tagname</a> &mdash; $nposts $word</li>"
             echo "<li><a href=\"$i\">$tagname</a> &mdash; $nposts $word</li>"
         done
         done