New Blog Host Adopted

As the future of ootput.bur.st remains bleak, I have been forced to seek alternative hosting locations. wordpress.com provides free hosting for blogs powered by WordPress, and I have chosen to use it as a temporary host while I wait for the outcome of bur.st‘s acquisition.

wordpress.com provides a decent service to the occasional blogger who has no intention of hosting their own site. I personally felt very much at home after successfully importing posts from the Habari-based ootput.bur.st. Of course, as wordpress.com wasn’t a self-hosted solution to the bur.st issue, I was limited to whatever functionality the blog was permitted to exhibit by the WordPress team. (read: no additional plugins allowed)

The transition from Habari to WordPress was not a straightforward process, however. In order to export all of Habari’s posts to a format recognised by wordpress.com, I had to host a WordPress blog on bur.st where I could create the appropriate MySQL tables for WordPress. wordpress.com does not provide direct MySQL access for its members, and this effectively prevents the Habari->Wordpress script from working.

Regardless, once I had exported data to the bur.st-hosted WordPress, I was then able to produce a WordPress->WordPress export file to be imported into wordpress.com

It was a tedious process, but it saved me a lot of time in transferring content onto the new blog.

In order to redirect users to my new wordpress.com blog, and to properly block search bots from accessing the domain (e.g. Google), I created the following two files in ootput.bur.st‘s root directory:
.htaccess:

1
2
3
4
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://ootput.github.io/$1 [R=301,L]

robots.txt:

1
2
3
User-agent: *
Disallow: /

Of course, these two files will be obliterated once the bur.st merger is officially complete.

NB: Interestingly, my final login to shell.bur.st showed new mail in my mailbox - where I had never received e-mail in the past. There was a total of 10 e-mails, and all of them were spam. I suppose it was someone’s last ditched effort to generate some income from bur.st members - which was kind of lame. As the account effectively expires on the 1st July, this desperate attempt seemed rather stupid.

On Chyrp's Revival

I completely missed the boat on this one, but apparently, ten months ago, Chyrp came back.

Provided the project persists and progresses, I might consider taking another look at the platform that I had once loved. In the meantime, I’ll stick with Habari - which I have grown accustomed to. I know that Chyrp is a very young product, but it’s sudden termination was simply too much to bear - I honestly can’t get my hopes up again.

Truth be told, I’m actually very pleased to hear that the product was restarted - it would have been a shame to have let such a promising piece of software go to waste. Even Chyrps website’s design was delicious:
7180191615_fd16650d0b

I wish the team the best of luck with all of their endeavours.

Patch MetaSEO in Habari

(MetaSEO) adds search engine optimizations to the page head.

Habari’s plug-in doesn’t provide an option to configure web-robot caching. I created the following patch to address this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- metaseo.plugin.php 2011-10-06 18:54:14.326378049 +0800
+++ metaseo.plugin.php-nocache 2011-10-06 18:53:37.566385150 +0800
@@ -69,10 +69,13 @@
'home_keywords' => $home_keys,
'home_index' => true,
'home_follow' => true,
+ 'home_cache' => false,
'posts_index' => true,
'posts_follow' => true,
+ 'posts_cache' => true,
'archives_index' => false,
'archives_follow' => true,
+ 'archives_cache' => false,
);
}
@@ -133,10 +136,13 @@
$ui->append( 'fieldset', 'Robots', _t( 'Robots', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'home_index', 'option:MetaSEO__home_index', _t( 'Index Home Page', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'home_follow', 'option:MetaSEO__home_follow', _t( 'Follow Home Page Links', 'metaseo' ) );
+ $ui->Robots->append( 'checkbox', 'home_cache', 'option:MetaSEO__home_cache', _t( 'Cache Home Page', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'posts_index', 'option:MetaSEO__posts_index', _t( 'Index Posts', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'posts_follow', 'option:MetaSEO__posts_follow', _t( 'Follow Post Links', 'metaseo' ) );
+ $ui->Robots->append( 'checkbox', 'posts_cache', 'option:MetaSEO__posts_cache', _t( 'Cache Posts', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'archives_index', 'option:MetaSEO__archives_index', _t( 'Index Archives', 'metaseo' ) );
$ui->Robots->append( 'checkbox', 'archives_follow', 'option:MetaSEO__archives_follow', _t( 'Follow Archive Links', 'metaseo' ) );
+ $ui->Robots->append( 'checkbox', 'archives_cache', 'option:MetaSEO__archives_cache', _t( 'Cache Archives', 'metaseo' ) );
$ui->append( 'submit', 'save', _t( 'Save', 'metaseo' ) );
$ui->out();
@@ -381,6 +387,12 @@
else {
$robots .= ', nofollow';
}
+ if ( !Options::get( 'MetaSEO__posts_cache' ) ) {
+ $robots .= ', noarchive';
+ }
break;
case 'display_home':
if ( Options::get( 'MetaSEO__home_index' ) ) {
@@ -395,6 +407,12 @@
else {
$robots .= ', nofollow';
}
+ if ( !Options::get( 'MetaSEO__home_cache' ) ) {
+ $robots .= ', noarchive';
+ }
break;
case 'display_entries_by_tag':
case 'display_entries_by_date':
@@ -411,6 +429,12 @@
else {
$robots .= ', nofollow';
}
+ if ( !Options::get( 'MetaSEO__archives_cache' ) ) {
+ $robots .= ', noarchive';
+ }
break;
default:
$robots = 'noindex, follow';

Gist Extras in Habari

Gist Extras embeds gists in post content, and allows for the use of custom CSS.

Unfortunately, the author has not updated the plug-in for Habari 0.7 - where plug-in information now resides in a separate XML file. To address this, make the following changes to gistextras.plugin.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*** user/plugins/gistextras/gistextras.plugin.php.orig 2010-06-26 22:11:59.777117173 +0800
--- user/plugins/gistextras/gistextras.plugin.php 2010-06-26 22:11:32.328366681 +0800
***************
*** 2,20 ****
class GistExtras extends Plugin
{
- public function info()
- {
- return array(
- 'url' => 'http://andrewhutchings.com',
- 'name' => 'Gist Extras',
- 'description' => 'Embeds gists in post content, and allows for the use of custom CSS.',
- 'license' => 'Apache License 2.0',
- 'author' => 'Andrew Hutchings',
- 'authorurl' => 'http://andrewhutchings.com',
- 'version' => '0.0.2'
- );
- }
-
public function action_update_check()
{
Update::add( 'GistExtras', 'A6A9D42C-2F4F-11DE-BB63-026155D89593', $this->info->version );
--- 2,7 ----

You’ll also need to create gistextras.plugin.xml:

1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8" ?>
<pluggable type="plugin">
<name>Gist Extras</name>
<license url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software License 2.0</license>
<url>http://andrewhutchings.com</url>
<author url="http://andrewhutchings.com">Andrew Hutchings</author>
<version>0.0.2</version>
<description><![CDATA[Embeds gists in post content, and allows for the use of custom CSS.]]></description>
<copyright>2009</copyright>
</pluggable>

Extending the Habari Sidebar

Habari’s sidebar (in K2) is very minimal. The following plug-ins provide much needed site-navigation:

Fluffytag shows a fluffy cloud of tags.
monthly_archives shows archives grouped by month.

To display output from both plug-ins, make the following changes to sidebar.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
*** system/themes/k2/sidebar.php 2010-06-21 22:15:10.587118909 +0800
--- user/themes/k2/sidebar.php 2010-06-26 14:52:35.928366633 +0800
***************
*** 13,18 ****
--- 13,28 ----
<?php $theme->area( 'sidebar' ); ?>
+ <div class="sb-archives">
+ <h2><?php _e('Archives'); ?></h2>
+ <?php $theme->monthly_archives ( '0','N' ); ?>
+ </div>
+
+ <div class="sb-tags">
+ <h2><?php _e('Tags'); ?></h2>
+ <?php $theme->fluffytag(); ?>
+ </div>
+
<div class="sb-user">
<h2><?php _e('User'); ?></h2>
<?php $theme->display ( 'loginform' ); ?>

Fluffytag’s appearance was slightly modified with the following changes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Index: fluffytag.css
===================================================================
--- fluffytag.css (revision 3226)
+++ fluffytag.css (working copy)
@@ -7,11 +7,10 @@
#fluffytag li a {
margin: 0px;
line-height: 34px;
- color: #000;
+ color: #CCCCCC;
}
#fluffytag li a:hover {
- background: #000;
- color: #fff;
+ color: #444444;
}
#fluffytag .step-1 a {
font-size: 1.0em;
@@ -42,4 +41,4 @@
}
#fluffytag .step-10 a {
font-size: 2.8em;
-}
\ No newline at end of file
+}

Code in Habari

Using <code>, I can post short code snippets without relying on Github. e.g,

// my first program in C++
#include 
using namespace std;
int main ()
{
  cout << "Hello World!";
  return 0;
}

Habari has two plug-ins that cater especially to code snippets:

google-code-prettify allows syntax highlighting of source code snippets.

code_escape runs htmlspecialchars() on any code blocks in your post.

Whilst in user/plugins, fetch both plug-ins from their subversion repositories:

$ svn checkout http://svn.habariproject.org/habari-extras/plugins/google-code-prettify/trunk google-code-prettify $ svn checkout http://svn.habariproject.org/habari-extras/plugins/code_escape/trunk code_escape

Make the following changes to plugins/code_escape/code_escape.plugin.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Index: code_escape.plugin.php
===================================================================
--- code_escape.plugin.php (revision 3226)
+++ code_escape.plugin.php (working copy)
@@ -4,7 +4,7 @@
public function filter_post_content_out ( $content, $post ) {
- $content = preg_replace_callback('/<code>(.*?)<\/code>/s', array( 'self', 'escape_code' ), $content);
+ $content = preg_replace_callback('/<code class="prettyprint">(.*?)&lt;\/code&gt;/s', array( 'self', 'escape_code' ), $content);
return $content;
@@ -16,7 +16,7 @@
$string = htmlspecialchars( $string );
- $string = '&lt;code&gt;' . $string . '</code>';
+ $string = '<code class="prettyprint">' . $string . '</code>';
return $string;
@@ -30,4 +30,4 @@
}
-?>
\ No newline at end of file
+?>

Filter Habari Pages by Tags

Habari’s pages, while taggable, aren’t filtered; Habari’s content filters only apply to entries. This can be easily addressed by modifying the theme - for example, with K2, make the following changes to themes/k2/theme.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
*** system/themes/k2/theme.php 2010-06-21 22:15:10.587118909 +0800
--- user/themes/k2/theme.php 2010-06-23 20:00:35.488368879 +0800
***************
*** 46,51 ****
--- 46,70 ----
* template. So the values here, unless checked, will overwrite any existing
* values.
*/
+
+ /**
+ * Filter the parameters being passed to Posts::get()
+ *
+ * @param array $filters The parameters to be passed to Posts::get()
+ *
+ * @return array The updated parameters
+ */
+ public function filter_template_where_filters( $filters )
+ {
+
+ if( isset( $filters['content_type'] ) ) {
+ $types = Utils::single_array( $filters->offsetGet( 'content_type' ) );
+ $types[] = Post::type( 'page' );
+ $filters->offsetSet( 'content_type', $types );
+ }
+ return $filters;
+ }
+
public function add_template_vars()
{
//Theme Options

Upgrade to Habari Trunk

To upgrade Habari to the latest development snapshot, read this. Be mindful of the format changes mentioned in Upgrade Notes here.

Move your existing set of plug-ins (at user/plugins/) to user/plugins_prev/ for safe-keeping.

Issue the following command from a MySQL shell to deactivate all active plug-ins:

mysql> DELETE from habari__options WHERE name = "active_plugins";

To update the plug-ins, you will need to search Habari’s plug-ins index for replacement versions 0.7.x.y or trunk.

Gravatar in Habari

Gravatar adds a comment author’s Gravatar by adding <img src="gravatar ?>"> to the relevant file(s) in your theme.

For the K2 theme, make the following changes to themes/k2/comments.php:

1
2
3
4
5
6
7
8
9
10
11
*** system/themes/k2/comments.php 2010-06-21 22:15:10.587118909 +0800
--- user/themes/k2/comments.php 2010-06-21 23:20:23.068368014 +0800
***************
*** 22,27 ****
--- 22,28 ----
?>
<li id="comment-<?php echo $comment->id; ?>" <?php echo $theme->k2_comment_class( $comment, $post ); ?>>
<a href="#comment-<?php echo $comment->id; ?>" class="counter" title="<?php _e('Permanent Link to this Comment'); ?>"><?php echo $comment->id; ?></a>
+ <img src="<? echo $comment->gravatar ?>">
<span class="commentauthor"><?php echo $comment_url; ?></span>
<small class="comment-meta"><a href="#comment-<?php echo $comment->id; ?>" title="<?php _e('Time of this Comment'); ?>"><?php $comment->date->out(); ?></a><?php if ( $comment->status == Comment::STATUS_UNAPPROVED ) : ?> <em><?php _e('In moderation'); ?></em><?php endif; ?></small>

Github Gists in Habari

To avoid having wasted space in embedded gists, make the following changes to user/themes/k2/style.css:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
*** system/themes/k2/style.css 2010-06-21 22:15:10.587118909 +0800
--- user/themes/k2/style.css 2010-06-27 21:22:38.248366535 +0800
***************
*** 891,895 ****
--- 891,902 ----
border: 1px solid #999;
}
+ /*-
+ Github Gists
+ */
+
+ .gist { text-indent:0 !important; }
+ .gist-highlight { line-height: 1.2em !important;}
+
/* Peace and forgiveness */
/* Learn more about the other K2: http://en.wikipedia.org/wiki/K2 */