z-blogPHP的关键词及描述的SEO优化方案

最近一直使用z-blogPHP系统建站,由于该系统是国人朋友刚刚从ASP代码中翻译过来的,部分功能还未能那么完善。其中,关于SEO优化的优化也有待开发。官方给出的优化代码是:

{php}
        if($type=='index'){
                $keywords = $zbp->option['ZC_BLOG_SUBNAME'];
                $description = $zbp->option['ZC_BLOG_COPYRIGHT'];
        }elseif($type=='category'){
                $keywords = $category->Name;
                $description = $category->Intro;
        }elseif($type=='article'||$type=='page'){
                $aryTags = array();
                foreach($article->Tags as $key){
                        $aryTags[] = $key->Name;
                }
                if(count($aryTags)>0) $keywords = implode(',',$aryTags);
                $description = preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($article->Content,'[nohtml]'),100)).'...');
        }
{/php}
{if isset($keywords)&&strlen($keywords)>0}
<meta name="keywords" content="{$keywords}" />
{/if}
{if isset($description)&&strlen($description)>0}
<meta name="description" content="{$description}" />

这个方案我感觉还是比较可行的,首先是首页、文章页面判断。如果是文章页面,关键词变为内容页的“标签”,描述为文章的“摘要”;如果是网站首页,那么关键词变成网站的副标题,描述取的是首页的底部COPYRIGHT部分,也就是我们通常说的底部标签。这个取法我感觉还是有争议的,因为网站底部我们通常为放置备案信息、站长统计等,并不是理想的获取东西,于是我建议将3-4行变更为关键词自行设置,网页描述改为网站副标题:

$keywords = '科技控,科幻宅,伪发明家';
$description = $zbp->option['ZC_BLOG_SUBNAME'];