From fda069c42811bce1743abd27db57b5cb75279d76 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Fri, 10 Jan 2014 10:51:48 +0100 Subject: Update README.md --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 7f5791f..170c349 100644 --- a/README.md +++ b/README.md @@ -9,51 +9,80 @@ I created it because I wanted a very, very simple way to post entries to a blog You can read [the initial blog post](http://mmb.pcb.ub.es/~carlesfe/blog/creating-a-simple-blog-system-with-a-500-line-bash-script.html) for more information and as a demo, as my site has been 100% generated using bashblog. + +Features +-------- + +- Everything stored in a single 700-line bash script! Just download and start writing. +- GNU/Linux, BSD and OSX compatible out of the box (no need for GNU `coreutils` on a Mac) +- Simple creation and edition of the posts with your favorite text editor +- Support for Markdown, Disqus comments, Twitter, RSS, Feedburner, Google Analytics + + Usage ----- -You only need SSH access to a server which allows its users to run shell scripts. +You will need SSH access to a server which allows its users to run shell scripts. More advanced users could +mount a server folder via `ftpfs` and run this script locally, however, it can be quite slow. -Copy bb.sh into a public folder of yours and run it: +Copy bb.sh into a public folder of yours (for example, `public_html/blog`) and run it: ./bb.sh This will show the available commands. If the file is not executable, you can either `chmod +x bb.sh` or run it with `bash bb.sh` -**Before creating a blog post, edit `bb.sh` and modify the variables in the `global_variables()` function or create a `.config` file with your configutation values** +**Before creating your first post, you may want to configure the blog settings (title, author name, etc). +Read the Configuration section below for more information** -To create your first post, make sure `$EDITOR` is set, and then just do: +To create your first post, just run: ./bb.sh post When you're done, access the public URL for that folder and you should see the index file and a new page for that post! -Features --------- -- Simple creation and edition of the posts with your favorite text editor -- **NEW** Markdown support via a third-party library (e.g. +Configuration +------------- + +Configuration is not required for a test drive, but if you plan on running your blog with bashblog, you will +want to change the default titles, author names, etc, to match your own. + +There are two ways to configure the blog strings: + +- Edit `bb.sh` and modify the variables in the `global_variables()` function +- Create a `.config` file with your configuration values (useful if you don't want to touch the script). You can find + the `global_variables()` function on the script + +The software will load the values in the script first, then overwrite them with the values in the `.config` file. +This means that you don't need to define all variables in the config file, only those which you need to override +from the defaults. + +Please note that bashblog uses the `$EDITOR` environment value to open the text editor. + + +Detailed features +----------------- + +- A simple but nice and readable design, with nothing but the blog posts +- **NEW on 2.0** Markdown support via a third-party library (e.g. [Markdown.pl](http://daringfireball.net/projects/markdown/)). Use it via `./bb.sh post -m`. The third party library must support an invokation like `markdown_bin in.html > out.md` as the code calls it that way. - Post preview -- Save posts as drafts and resume later -- Transformation of every post to its own html page, using the title as the URL -- Generation of an index.html file with the latest 10 posts -- Generation of an RSS file! Blog's magic is the RSS file, isn't it...? -- Generation of a page with all posts, to solve the index.html pagination problem -- Rebuilding the index files without the need to create a new entry -- By default, comments are delegated to Twitter. Can be configured for Disqus -- Google Analytics support -- Feedburner support -- Auto-generated CSS support +- Save posts as drafts and resume editing later +- HTML page for each post, using its title as the URL +- Configurable number of posts on the front page +- Automatic generation of an RSS file, feedburner support +- Additional page containing an index of all posts +- Rebuild all files while keeping the original data +- Comments delegated to Twitter, with additional Disqus support +- Google Analytics code support +- Contains its own CSS so that everything is reasonably styled by default - Headers, footers, and in general everything that a well-structured html file needs - xhtml validation, CSS validation, RSS validation by the w3c - Backup of the site every time you post -- Everything contained in a single 700-line bash script! -- A simple but nice and readable design, with nothing but the blog posts Read the CHANGELOG section of the script header for more updates -- cgit v1.2.3 From fe518c5fce0289da95ea833e4bc79ffd581cabb2 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Fri, 10 Jan 2014 11:02:07 +0100 Subject: Update README.md --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 170c349..c177096 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,11 @@ You can read [the initial blog post](http://mmb.pcb.ub.es/~carlesfe/blog/creatin Features -------- -- Everything stored in a single 700-line bash script! Just download and start writing. +- Everything stored in a single 700-line bash script! Download `bb.sh` and start writing. - GNU/Linux, BSD and OSX compatible out of the box (no need for GNU `coreutils` on a Mac) - Simple creation and edition of the posts with your favorite text editor -- Support for Markdown, Disqus comments, Twitter, RSS, Feedburner, Google Analytics +- Allows drafts, includes a simple but clean stylesheet, generates the RSS file automatically +- Support for Markdown, Disqus comments, Twitter, Feedburner, Google Analytics Usage @@ -52,13 +53,16 @@ want to change the default titles, author names, etc, to match your own. There are two ways to configure the blog strings: - Edit `bb.sh` and modify the variables in the `global_variables()` function -- Create a `.config` file with your configuration values (useful if you don't want to touch the script). You can find - the `global_variables()` function on the script +- Create a `.config` file with your configuration values (useful if you don't want to touch the script) The software will load the values in the script first, then overwrite them with the values in the `.config` file. This means that you don't need to define all variables in the config file, only those which you need to override from the defaults. +The format of the `.config` file is just one `variablename="value"` per line, just like in the `global_variables()` +function. Remember to quote the values, do not declare a variable with the dollar sign, and do not use spaces around the +equal sign. + Please note that bashblog uses the `$EDITOR` environment value to open the text editor. @@ -82,13 +86,6 @@ Detailed features - Contains its own CSS so that everything is reasonably styled by default - Headers, footers, and in general everything that a well-structured html file needs - xhtml validation, CSS validation, RSS validation by the w3c -- Backup of the site every time you post +- Automatic backup of the site every time you post (stored as `.backup.tar.gz`) Read the CHANGELOG section of the script header for more updates - -Future ideas ------------- - -This software is still maintained, however, it can be considered more or less finished. -It has been used by many people and no bugs have been found, but if you happen to find one, -please report it. -- cgit v1.2.3 From ef3e350f29fc574344a9e27c224732e0bf6eac6c Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Fri, 10 Jan 2014 11:04:46 +0100 Subject: Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c177096..dc7df57 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ bashblog ======== -A Bash script that handles blog posting. +A Bash script that handles blog posting. -Some would say it's a CMS, but I don't like that word. It's just a script that lets you write a blog post with your favorite editor, puts all the posts together into an index, and creates an RSS file and a list of posts. +Download it to a public folder, run `./bb.sh post`, write the post, and that's it. No templating, just plain text editing (HTML or Markdown). All the boilerplate (front page, headers, titles, RSS, etc) is handled by the script. I created it because I wanted a very, very simple way to post entries to a blog by using a public folder on my server, without any special requirements and dependencies. -- cgit v1.2.3 From b004cdbcd88f449128f0e41720c3fc651be45150 Mon Sep 17 00:00:00 2001 From: Carles Fenollosa Date: Fri, 17 Jan 2014 10:03:07 +0100 Subject: Fixed bug when $body_begin_file was empty Added extra line in the footer linking to the github project --- bb.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bb.sh b/bb.sh index 5cc0b49..f866730 100755 --- a/bb.sh +++ b/bb.sh @@ -64,6 +64,8 @@ # ######################################################################################### # +# 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 # 2.0 Added Markdown support # Fully support BSD date @@ -107,7 +109,7 @@ global_config=".config" # by the 'global_config' file contents global_variables() { global_software_name="BashBlog" - global_software_version="2.0.1" + global_software_version="2.0.2" # Blog title global_title="My fancy blog" @@ -342,7 +344,7 @@ create_html_page() { google_analytics >> "$filename" echo "" >> "$filename" # stuff to add before the actual body content - cat "$body_begin_file" >> "$filename" + [[ -n "$body_begin_file" ]] && cat "$body_begin_file" >> "$filename" # body divs echo '
' >> "$filename" echo '
' >> "$filename" @@ -649,7 +651,8 @@ create_includes() { if [[ -f "$footer_file" ]]; then cp "$footer_file" .footer.html else protected_mail="$(echo "$global_email" | sed 's/@/\@/g' | sed 's/\./\./g')" - echo '' >> ".footer.html" + echo '' >> ".footer.html" fi } -- cgit v1.2.3 From 135a983166f2a1259dd62205fb5223f41aec8272 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Fri, 17 Jan 2014 10:08:53 +0100 Subject: Update README.md --- README.md | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index dc7df57..ed2b6f4 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,45 @@ bashblog ======== -A Bash script that handles blog posting. +A single Bash script to create blogs. -Download it to a public folder, run `./bb.sh post`, write the post, and that's it. No templating, just plain text editing (HTML or Markdown). All the boilerplate (front page, headers, titles, RSS, etc) is handled by the script. +I created it because I wanted a very, very simple way to post entries to a blog by using a public folder on my server, without any special requirements and dependencies. Works on GNU/Linux, OSX and BSD. -I created it because I wanted a very, very simple way to post entries to a blog by using a public folder on my server, without any special requirements and dependencies. - -You can read [the initial blog post](http://mmb.pcb.ub.es/~carlesfe/blog/creating-a-simple-blog-system-with-a-500-line-bash-script.html) for more information and as a demo, as my site has been 100% generated using bashblog. +You can see it live here: [read the initial blog post](http://mmb.pcb.ub.es/~carlesfe/blog/creating-a-simple-blog-system-with-a-500-line-bash-script.html). My blog has been 100% generated using bashblog, no additional tweaking. Features -------- -- Everything stored in a single 700-line bash script! Download `bb.sh` and start writing. +- No installation required. Download `bb.sh` and start blogging. +- Ultra simple usage: Just type a post with your favorite editor and the script does the rest. No templating. +- All content is static. You only need shell access to a machine with a public web folder. + *Tip: advanced users could mount a remote public folder via `ftpfs` and run this script locally* +- Allows drafts, includes a simple but clean stylesheet, generates the RSS file automatically. +- Support for Markdown, Disqus comments, Twitter, Feedburner, Google Analytics. - GNU/Linux, BSD and OSX compatible out of the box (no need for GNU `coreutils` on a Mac) -- Simple creation and edition of the posts with your favorite text editor -- Allows drafts, includes a simple but clean stylesheet, generates the RSS file automatically -- Support for Markdown, Disqus comments, Twitter, Feedburner, Google Analytics +- Everything stored in a single 700-line bash script, how cool is that?! ;) Usage ----- -You will need SSH access to a server which allows its users to run shell scripts. More advanced users could -mount a server folder via `ftpfs` and run this script locally, however, it can be quite slow. - -Copy bb.sh into a public folder of yours (for example, `public_html/blog`) and run it: +Copy bb.sh into a public folder (for example, `$HOME/public_html/blog`) and run ./bb.sh This will show the available commands. If the file is not executable, you can either `chmod +x bb.sh` or run it with `bash bb.sh` -**Before creating your first post, you may want to configure the blog settings (title, author name, etc). +**Before creating your first post, you may want to configure the blog settings (title, author, etc). Read the Configuration section below for more information** To create your first post, just run: ./bb.sh post -When you're done, access the public URL for that folder and you should see the index -file and a new page for that post! +When you're done, access the public URL for that folder (e.g. `http://server.com/~username/blog`) +and you should see the index file and a new page for that post! Configuration @@ -60,10 +58,10 @@ This means that you don't need to define all variables in the config file, only from the defaults. The format of the `.config` file is just one `variablename="value"` per line, just like in the `global_variables()` -function. Remember to quote the values, do not declare a variable with the dollar sign, and do not use spaces around the -equal sign. +function. **Please remember:** quote the values, do not declare a variable with the dollar sign, do not use +spaces around the equal sign. -Please note that bashblog uses the `$EDITOR` environment value to open the text editor. +bashblog uses the `$EDITOR` environment value to open the text editor. Detailed features @@ -85,6 +83,7 @@ Detailed features - Google Analytics code support - Contains its own CSS so that everything is reasonably styled by default - Headers, footers, and in general everything that a well-structured html file needs +- Support to add extra content on top of every page (e.g. banners, images, etc) - xhtml validation, CSS validation, RSS validation by the w3c - Automatic backup of the site every time you post (stored as `.backup.tar.gz`) -- cgit v1.2.3 From 96e26b5aa0f7380ffa916fb408f6a7f25055f757 Mon Sep 17 00:00:00 2001 From: Hans Brigman Date: Mon, 3 Feb 2014 20:10:00 -0500 Subject: Stop Disqus "Comemnts?" link with no username The twitter() method wasn't checking for an empty string for global_disqus_username, so it would always generate the anchor tag for the Disqus comments, even if global_disqus_username was an empty string. Now the '-z' flag has been added to check for the empty string correctly. --- bb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bb.sh b/bb.sh index f866730..327b478 100755 --- a/bb.sh +++ b/bb.sh @@ -305,7 +305,7 @@ edit() { twitter() { [[ -z "$global_twitter_username" ]] && return - if [[ "$global_disqus_username" ]]; then + if [[ -z "$global_disqus_username" ]]; then echo "

$template_comments " else echo "

$template_comments  " -- cgit v1.2.3 From f05f1e834024d5d0bcf30caa26807b24a4b2c5a7 Mon Sep 17 00:00:00 2001 From: Hans Brigman Date: Mon, 3 Feb 2014 21:59:36 -0500 Subject: Don't process header/footer files as blog entries rebuild_all_entries wasn't checking if the file in question being processed was a header or footer file that could be specified in the configuration. Now it checks and skips them if they exist [like the index and archive file(s)]. --- bb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bb.sh b/bb.sh index f866730..5ae9f6d 100755 --- a/bb.sh +++ b/bb.sh @@ -712,7 +712,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" ]]; then continue; fi + if [[ "$i" == "$index_file" ]] || [[ "$i" == "$archive_index" ]] || [[ "$i" == "$footer_file" ]] || [[ "$i" == "$header_file" ]]; then continue; fi contentfile=".tmp.$RANDOM" while [ -f "$contentfile" ]; do contentfile=".tmp.$RANDOM"; done -- cgit v1.2.3