網頁

2006年12月6日 星期三

wordpress-mu sitemap plugin



抓取「Google Sitemap Generator 3 Beta」丟到 plugin 目錄,然後作些 dirty hack:
<blockquote>
<pre style="text-align: left">--- /home/admin/cookys/work/sitemap.php Thu Nov 16 22:26:58 2006
--- /home/admin/cookys/work/sitemap.php Thu Nov 16 22:26:58 2006
+++ sitemap.php Wed Dec 6 20:37:50 2006
@@ -865,6 +865,7 @@

[sourcecode language='php']
//the get_home_path function in our own...
$home = get_settings('home');
$home_path="";
+/*
if ( $home != '' && $home != get_settings('siteurl') ) {
$home_path = parse_url($home);
$home_path = $home_path['path'];
@@ -873,8 +874,10 @@
} else {
$home_path = ABSPATH;
}
+*/
$res = $home_path;
}
+ $res =ABSPATH.UPLOADS; //str_replace('/files','',ABSPATH.UPLOADS); // cookys dirty hack for wp-mu
return $res;
}

@@ -1313,7 +1316,7 @@
if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") {
return $this->GetOption("b_fileurl_manual");
} else {
- return trailingslashit(get_bloginfo('siteurl')). $this->GetOption("b_filename");
+ return trailingslashit(get_bloginfo('siteurl')).'files/'. $this->GetOption("b_filename");
}
}

@@ -2705,4 +2708,4 @@
#endregion
}

-?>
No newline at end of file
+?>
[/sourcecode]
然後把 .htaccess 補上一條
<pre>RewriteRule ^sitemap.xml /wp-content/blogs.php?file=sitemap.xml [L]</pre>
搞定收工。