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';