~stormdragon2976/bashtml

72ec0425 — Storm Dragon 1 year, 11 months ago
Some minor cleanup and comment changes.
a22841e9 — Storm Dragon 3 years ago
Added a page_bottom plugin.
e948ea0c — Storm Dragon 3 years ago
Changed to 2mb.codes.

refs

master
browse  log 

clone

read-only
https://git.2mb.codes/~stormdragon2976/bashtml
read/write
git@git.2mb.codes:~stormdragon2976/bashtml

You can also use your local clone with git send-email.

#BasHTML made-with-bash

A single Bash script to create blogs.

Originally created because Carlos Fenollosa wanted a very, very simple way to post entries to a blog by using a public folder on his server, without any special requirements and dependencies. Works on GNU/Linux and possibly OSX and BSD but I do not have these to test my changes. Expanded because I wanted to do writing locally, then post to a server after the fact, and I wanted to extend functionality without bloating the code beyond recognition.

How simple? Just three easy steps.

  • type: ./bashtml.sh
  • Edit the generated .config file to your liking.
  • type: ./bashtml post and start writing.

Check out other BasHTML users

#Usage

Run bashtml.sh in the directory where you want content created. This can be on the server itself, or your local computer.

./bashtml.sh

This will generate the .config file on the first run. On subsequent executions it will show the available commands.

To create your first post, just run:

./bashtml.sh post

It will try to use Markdown, if installed. To force HTML:

./bashtml.sh post -html

The script will handle the rest.

When you're done, if you edited files on the server, 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! If you created on your computer, you will have to upload the files first.

#Features

  • Ultra simple usage: Just type a post with your favorite editor and the script does the rest. No templating.
  • No installation required. Download bashtml.sh and start blogging.
  • Zero dependencies. It runs just on base utils (date, basename, grep, sed, head, etc)
  • GNU/Linux and possibly BSD and OSX compatible.
  • All content is static. Create content on the server, or locally and sync to the server easily with the sync plugin.
  • Allows drafts, includes a simple but clean stylesheet, generates the RSS file automatically.
  • Support for tags/categories
  • Support for Markdown, Google Analytics.
  • Optional powerful plugin system. Drop your plugins into a directory called plugins, or for system wide, /usr/share/bashtml/plugins.

#Configuration

Configuration is not required for a test drive, but if you plan on running your blog with BasHTML, you will want to change the default titles, author names, etc, to match your own.

To customize your configuration edit the .config file generated on the first run of bashtml.sh.

The format of the .config file is just one variablename="value" per line, just like in the global_variables() function. Please remember: quote the values, do not declare a variable with the dollar sign, do not use spaces around the equal sign. Just use the syntax of the generated file as a guide.

BasHTML 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.
    The easiest method is to download Gruber's Markdown.pl
  • Post preview
  • 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.
  • Additional page containing an index of all posts
  • Automatically generates pages for each tag
  • Rebuild all files while keeping the original data
  • 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)

#Plugins

Simply drop your plugins into a directory called plugins. If you want them available system wide, put them in /usr/share/bashtml/plugins. This is a work in progress, so more documentation is coming soon. Until then, check the bashtml.sh code for details. A plugin repository is available at https://git.2mb.codes/~stormdragon2976/bashtml-plugins.

Features

  • plugins are scripts sourced and called when needed.
  • Plugins have direct access to everything available in the bashtml.sh script, no need to pass everything the plugin should have during calls.
  • Plugins end with the .sh extension, so to disable one, simply rename with a different or no extension.

#Support My Work

Please Donate

#License

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

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 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/.