cfenollosa/bashblog: A single Bash script to create blogs. Download, run, write, done! · GitHub

A single bash script to create a blog.

I created it because I wanted a very simple way to post entries to a blog using a public folder on my server, without any special requirements and dependencies. Works on GNU/Linux, OSX and BSD.

How simple? just type ./bb.sh post And start writing your blogpost.

asciinema

You can see a sample here: Read the initial blog post. That page was built 100% using Bashblog, no additional changes.

demo

View other Bashblog users

Download the code and copy bb.sh to a public folder (for example, $HOME/public_html/blog) and run

This will show the available commands. If the file is not executable, type chmod +x bb.sh And try again.

Before creating your first post, you may want to configure blog settings (title, author, etc.). Read the configuration section below for more details

To create your first post, simply run:

If it is installed, it will try to use Markdown. To bind HTML:

The script will take care of the rest.

When you’re done, access the public URL for that folder (for example). http://server.com/~username/blog) and you should see the index file and a new page for that post!

Please read the wiki to learn how to use BashBlog’s advanced features, such as headers and footers, static pages, and more.

  • Extremely simple to use: simply type a post with your favorite editor and the script will do the rest. No templating.
  • No installation required. download bb.sh And start blogging.
  • Zero dependency. It runs only on base utilities (date, basename, grep, sed, headetc)
  • GNU/Linux, BSD and OSX compatible out of the box, no GNU required coreutils On a Mac. It does some magic to automatically figure out which command switch it needs to run, depending on your system.
  • All content is stable. You only need shell access to the machine containing the public web folder.
    Tip: Advanced users can mount a remote public folder via ftpfs and run this script locally
  • Allows drafts, includes a simple but clean stylesheet, generates RSS file automatically.
  • Support for tags/categories
  • Support for Markdown, Disqus Comments, Twitter, Feedburner, Google Analytics.
  • The project is still ongoing as of 2016. Bugs have been fixed, and new features have been considered (see “Contributions”).
  • Everything is stored in a ~1k line bash script, how cool is that?! 😉

Configuration is not required for the test drive, but if you plan to run your blog with BashBlog, you may want to change the default title, author name, etc. to match your own.

There are two ways to configure blog strings:

  • edit bb.sh and modify variables in global_variables() Celebration
  • create a .config File with your configuration values ​​- useful if you don’t want to touch the script and want to be able to update it regularly with Git

The software will first load the values ​​into the script, then overwrite them with the values .config file. This means that you do not need to define all the variables in the configuration file, only the variables that you need to override the default.

format of .config file is only one variablename="value" per line, exactly as global_variables()
Celebration. Please remember: Quote values, do not declare a variable with a dollar sign, do not use spaces around the equal sign.

uses bashblog $EDITOR Environment value to open the text editor.

  • A simple but nice and readable design, containing nothing but blog posts
  • New on 2.0 Markdown support via third-party libraries.
    The easiest way is to download Gruber’s Markdown.pl
  • post preview
  • Save post as draft and resume editing later
  • HTML page for each post, using its title as the URL
  • Configurable number of posts on home page
  • Automatic creation of RSS file, Feedburner support
  • Additional page containing index of all posts
  • Creates pages for each tag automatically
  • Rebuild all files keeping original data
  • Comments handed over to Twitter with additional Disqus support
  • An alternative to cookieless Twitter sharing to comply with EU cookie law
  • Google Analytics Code Support
  • It includes its own CSS so everything is styled appropriately by default
  • Headers, footers, and in general everything that a well-structured HTML file needs
  • Support for adding additional content to the top of each page (e.g. banners, images, etc.)
  • xhtml validation, css validation, rss validation by w3c
  • Automatic backup of the site (archived as) every time you post. .backup.tar.gz)

For more updates read the changelog section or check out the news on my blog

Bashblog started at 500 SLOC and has now reached the 1000 SLOC barrier. If we want to keep code minimal and understandable, we need to try harder to prevent ourselves from adding too many features.

All bug fixes are welcome, but brand new features need to be strongly justified to get into the main tree. Each new request will be discussed honestly and civilly in the comments. As a guideline, pull requests should:

  • Fix use case for some (like internationalization)
  • Add a use case that is arguably too common (e.g. Disqus integration for comments)
  • Be very small when possible (a few lines of code)
  • Does not require significant rewriting of the code (does not break). create_html_file() Or write_entry()etc)
  • It should work on Linux, BSD and Mac. Be careful using GNU coreutils with non-POSIX flags (ie date Or grep)
  • Follow the UNIX philosophy: do one thing and do it well, rely on third-party software for external features, etc.
  • Always Maintain backward compatibility when using the default configuration
  • 2.10 added global_twitter_card_image
  • 2.9 added body_begin_file_index
  • 2.8 bug fixes
    Slavic language support thanks to Tomasz Jadowski
    Now defunct Twitter JSON API share count removed
    Support for static, not managed by Bashblog HTML files
  • 2.7 Store the post date on a comment in an HTML file (#96).
    Upon rebuild, the post date will be synchronized between the comment date and the file date, with the comment date taking priority.
  • 2.6 Support for multiple authors, use a different one .config for every one
  • 2.5 Extensive code cleanup by Martijn Dekker
    ‘tag’ command
    The word ‘post’ now has a single form in the tag list (both website and command), see template_tags_posts_singular
  • 2.4 Added Twitter summary metadata for posts (#36)
  • 2.3.3 Large comment header removed.
    Added option to display tags for cut articles on index pages (#61)
    “All Posts” page cleared (#57)
  • 2.3.2 Option to use Topsy instead of Twitter for reference
  • 2.3.1 Cookieless Twitter Alternatives
  • 2.3 Intelligent tag reconstruction and markdown by default
  • 2.2 Flexible Post Title -> File Name Conversion
  • 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 to footer linking to Github project
  • 2.0.1 Allow personalized header/footer files
  • 2.0 Markdown support added.
    Full support BSD date
  • 1.6.4 Fixed bug in local dates
  • 1.6.3 BSD date now supported
  • 1.6.2 Some functions and variables were simplified to avoid duplicate information
  • 1.6.1 Set ‘date’ when hours are 1 digit.
  • 1.6.0 Disqus Comments. External configuration file. Check ‘date’ command version.
  • 1.5.1 Miscellaneous bugfixes and parameter checks
  • 1.5 Đurađ Radojičić (djura-san) refactored some code and added flexibility and i18n.
  • 1.4.2 Issues are now handled on Github
  • 1.4.1 Some code refactoring
  • 1.4 Using Twitter for comments, improving the ‘repost’ command
  • 1.3 ‘Edit’ command
  • 1.2.2 Feedburner Support
  • 1.2.1 Timestamp bug fixed
  • 1.2 ‘list’ command
  • 1.1 Draft and Preview Support
  • 1.0 Read http://is.gd/Bkdoru

This program is free software: you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of that License, or (at your option) any later version.

This program is distributed in the expectation that it will be useful, but without any warranty; WITHOUT IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.



<a href

Leave a Comment