Selling cookie info to third-parties is a classic example of you can make money without doing evil.
RSS

Count the comments!

2005/01/04 filed under /nanoblogger

I'm very new to NanoBlogger, yet impressed by it's power and coolness.

After installing CGIComment I realized there's no counter of comments per post. There's of course comment_cnt.sh by dams, but I didn't really fancy the idea of using wget for this task. The .db files didn't look that hard to parse, so here's the overkill-oneliner-that-should-have-been-shorter.

First you will have to edit the blog.conf and add CGICOMMENT_DIR="" with the path to your CGIComment directory:

# CGIComment directory
CGICOMMENT_DIR="$BLOG_DIR/cgicomment"

After that, create the file comment_count.sh in your $BASE_URL/plugins/entry/ directory:

# NanoBlogger plugin to get number of (cgicomment) comments without wget
# by B10m, 2005 (http://menno.b10m.net/)

NB_EntryCommentCount=$(grep -c "^$(sed -ne \
  "s/^\([0-9]*\)|archives\/$permalink_entry$/\\1/p" \
  $CGICOMMENT_DIR/comments/articles.db 2>/dev/null)|" \
  $CGICOMMENT_DIR/comments/comments.db 2>/dev/null) 

if [[ -z $NB_EntryCommentCount ]]; then NB_EntryCommentCount=0; fi

(UPDATE: Removed the `echo` calls to prevent unwanted output in archives/index.html)

To be compatible with comment_cnt.sh, I used the same variable $NB_EntryCommentCount,so (if not already done) alter your templates (entry.html, permalink_entry.html) accordingly:

<a href="$BLOG_URL_ACTION$ARCHIVES_DIR/$permalink_entry#comments">Comments</a>
 ($NB_EntryCommentCount)

Final note: as with comment_cnt.sh, the counter will only be updated each time you rebuild your blog!

Posted by: B10m | permanent link | comments (3)

First Post!

2005/01/04 filed under /news

Welcome to the B10[m|g]!

After a few years, I've decided to mess with a blog (again), basically just because nanoblogger seems to be really cool :)

I'll try to edit the CSS soon, so this blog doesn't look like a default blog, although I must say the default settings look pretty good to begin with :)

Posted by: B10m | permanent link | comments (1)
return-member