MT插件Technorati Tags是以空格作为分隔符来区别多个关键字的,比如 "Movable Type" 表示的是 "Movable"和 "Type" 两个 Tag ,那如果我想在页面上显示"Movable Type",而 Tag 的链接指向是"Movable"+ "Type",该怎么办?
修改 plugins/TechnoratiTags.pl 文件,找到
$output .= "$tag ";
将其替换成
$output .= "" ;
$tag =~s/\+/ /g;
$output .= "$tag" ;
这里主要利用了 Perl 的正则表示式来做到替换的目的,其中$tag =~s/\+/ /g; 加号就是连接字符,这样在发布的时候就在关键字一栏输入 Movable+Type ,显示在页面上的将是 "Movable Type",而 Tag 的链接指向是 http://technorati.com/tag/movable+type
PS. 作为连接符的加号可以自行用其他字符替换掉

Leave a comment