Not wanting to miss anything on this short urls business, I’ve implemented something similar in nanoblogger.
How? With a shell script and symlinks, my dear Watson. As with all shell scripting this is probably something you can do drunk.
First I need to get a list of all my articles so that I can link to them. Next I take this permalink address, pipe it through sha1sum, take the last 10 characters and make a symlink from the permalink path and presto: short urls
All these wordpress blogs have a related articles line below the blog entries. Sadly nanoblogger does not have such a capability, so I wrote my own. It’s not a plugin in the nanoblogger sense of the word, it may be possible to rewrite it as a regular plugin, but I do not now how…
So for now a simple shell script, which you can find here.
Usage within a template In your templates you should include the following:
Update (200911-08): I’ve stopped using this, because it made the archive generating fail in mysterious ways…
As you might have seen I have now these nice (opinions may vary) “more…” links in my blog. This is done with some JavaScript and shell foo and in this entry I will explain how I did it.
The setup also works with text browsers and people who disable JavaScript. In the latter case you will get the normal nb behavior where you see the entire article.
Basicly these blog items serve as a personal reminder and documentation. Also the code needs to be refactored a bit and some html tags need to be removed from it.
Files needed The following files are needed for this comment system:
comment.php, this is the PHP file the implements everything
nbadmin, a small shell script that implemented the comment moderation (just a mv of the comment to the correct directory)
I’ve implemented a simple comment system in which
there are no user accounts has a preview function once a comment is submitted you cannot edit it anymore all comments are moderated a small set of BB tags are allowed implemented as one PHP file the PHP script has some html in it needs a writeable directory in your document root You need this file: comment.php.
The first few lines allow for some customization:
I’ve been thinking about comments on my blog ever since I started using nanoblogger. While nb is great (with VIM and markdown) I’m starting to miss the comment stuff.
Comment systems for nb I’ve been searching for a good comment system that I want to use for nb. It should meet the following criteria:
Simple moderation system. With all the spam nowadays every comment made should be moderated. Should not require a database, the filesystem is enough of a database to handle these tasks.
Or how to create new builtins for use in bash. Short answer: you can, but it is not enabled by default (at least on my distribution, Ubuntu)
This is also something that is done much better in zsh.
Why do want this? SPEED!
Shell scripting is a very easy way to program, but forking all these helper programs takes a lot of time. So one way to speed up your shell program is to load these programs into the shell and making them a builtin.
I’ve made a small plugin which generates a tag cloud for your nb style blog. It’s probably a bit rough aroudn the edges, but it works, as you can see on the right.
You can fetch it here.
I’m using the gallery plugin for the photos on this site. This plugin works great and easy, but there wasn’t an easy way to create a slide show. So that you can click ’next’ and go to the next photo. So I’ve added this functionality to the script.
I’m putting this up for download, so that other people may use this too. gallery.sh If you want to regenerate the slides, you can just remove the html and slides directories.