nanoblogger - blogging engine written in Bash
Just some hints for getting started with nanoblogger, a small weblog engine written in Bash for creating static HTML pages.
There are, of course, many non-Bash alternatives including WadcomBlog (Python) and nanoc (Ruby).
There are, of course, many non-Bash alternatives including WadcomBlog (Python) and nanoc (Ruby).
cd ~/Desktop curl -L -O http://nanoblogger.sourceforge.net/downloads/nanoblogger-3.4-rc2.tar.gz tar -xzf nanoblogger-3.4-rc2.tar.gz # cf. nb manual function nbdoc() { open ~/Desktop/nanoblogger-3.4-rc2/docs/nanoblogger.html; return 0; } function myblog() { open ~/Desktop/MyLocalBlog/index.html; return 0; } alias nb=~/Desktop/nanoblogger-3.4-rc2/nb #function nb() { ~/Desktop/nanoblogger-3.4-rc2/nb "${@}"; return 0; } export EDITOR=nano export BLOG_DIR=~/Desktop/MyLocalBlog # will be created by nanoblogger below if [[ -d "${BLOG_DIR}" ]]; then echo "Weblog directory already exists: ${BLOG_DIR}"; fi if [[ ! -d "${BLOG_DIR}" ]]; then nb add weblog #nb -b ~/Desktop/MyLocalBlog add weblog #nb --blog-dir ~/Desktop/MyLocalBlog add weblog fi ... would you like to configure the new weblog now? [Y/n] n ... # test nb --version nb --help nb -h ls -ld ~/Desktop/MyLocalBlog #open -a Finder ~/Desktop/MyLocalBlog nbdoc myblog # edit blog.conf #nb configure #nb configure update all #open -e ~/Desktop/MyLocalBlog/blog.conf /bin/cat >> ~/Desktop/MyLocalBlog/blog.conf <<-'EOF' #BLOG_CSS="styles/nb_clean.css" #ARTICLES_DIR="articles articles/misc" DATE_FORMAT="%Y-%m-%d" DATE_LOCALE="$LANG" #DATE_ARGS="-u" #DB_DATEARGS="-u" NB_BROWSER=open EOF nb update all nb update-cache all nb manual # 6. Managing Entries and Tags (Categories) # Creating Entries nb add entry TITLE: test 1 AUTHOR: $(/usr/bin/logname) DATE: DESC: test 1 FORMAT: raw ----- BODY: <p>This is test entry 1 ...</p> END----- nb -l tags nb --tag 1 --title "test 2" add entry nb --tag 1 --title "test 3" --author $(/usr/bin/logname) --text "This is test entry 3 ..." add entry # create a new draft nb draft ~/Desktop/somefile.txt TITLE: test 4 - draft AUTHOR: $(/usr/bin/logname) DATE: DESC: draft FORMAT: raw ----- BODY: <p>This is test entry 4 ...</p> END----- # import the draft as a new entry nb --tag 1 import entry ~/Desktop/somefile.txt # update #nb update all nb -u 2008-09 # create a new tag nb -l tags nb --title examples add tag nb -l tags nb --tag 1,2 --title "test 5 - new tag" --author $(/usr/bin/logname) --text "This is test entry 5 ..." add entry # list entries, tags, ... nb -l nb -l all #nb -l entry nb -l tags nb -l cat nb -l 2008-09 # edit entry no. 5 nb edit entry 5 # "When modifying entries based on it's tag, ID's for both tag and entry must be specified." nb --tag 1,2 edit entry 1 # assign a tag to a specified entry nb -l nb --tag 2 tag-entry 2 nb -l myblog # permanently delete multiple entries nb -l nb delete entry 1,2,3,4,5 nb -l myblog # delete a tag nb -l tags nb delete tag 2 nb -l tags myblog # add an article nb --title 'my example article 1' add article TITLE: my example article 1 AUTHOR: $(/usr/bin/logname) DATE: DESC: article FORMAT: raw ----- BODY: <p>This is my example article 1 ...</p> END----- # http://nanoblogger.sourceforge.net/archives/2008/01/12/mutlitask/ nb draft ${BLOG_DIR}/articles/my_example_article_1.txt nb draft ${BLOG_DIR}/articles/my_example_article_1.txt update # add some text myblog # add a comment system using http://js-kit.com/blog/ # cf. JS-Kit + nanoblogger, http://devrandom.blogsite.org/archives/2008/05/20/js-kit__nanoblogger/ # and http://js-kit.com/blog/2008/05/17/comments-service-features/ # put the following line in entry.htm and permalink_entry.htm templates after the Permalink or the Categories link <br/><div class="js-kit-comments" path="/comments/$NB_EntryID"></div> # put anywhere in the body section of main_index.htm, month_archive.htm, permalink.htm and day_archive.htm <script src="http://js-kit.com/comments.js"></script> # alternative to JS-Kit: blogkomm + nanoblogger, # http://tstotts.net/blog/archives/2007/04/22/blogkomm__nanoblogger_p_1/ #-------------------------------------------------------------- # analyze the command "nb update all" from a second Terminal window # create Terminal window 2: [cmd-n] # use one of the fs_usage commands below ... /usr/bin/sudo /usr/bin/fs_usage -e egrep -f network | /usr/bin/egrep nb /usr/bin/sudo /usr/bin/fs_usage -e egrep -f cachehit | /usr/bin/egrep nb /usr/bin/sudo /usr/bin/fs_usage -e egrep -f network filesys | /usr/bin/egrep nb /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep nb | /usr/bin/tee ~/Desktop/nb_fsusage.log /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep tmp | /usr/bin/tee ~/Desktop/nb_fsusage.log /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep 'open.+tmp' /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep '(open|write|close).+tmp' /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep '(l?stat|unlink|pathconf).+tmp' /usr/bin/sudo /usr/bin/fs_usage -e egrep -f filesys | /usr/bin/egrep '(open|write|close).+(cat|cut|grep|sed)' # ... then enter in Terminal window 1 nb update all