seo优化修改之:增加首页唯一url标签 canonical
                            一.模板文件 1处:在 view/模板目录/global/header_meta.tpl.htm 的 <meta name="description" content="<?php echo $this->_meta_description; ?>"  /> 下面添加
 
<?php if (isset($this->canonical_url)) { ?><link rel="canonical" href="<?php echo $this->canonical_url; ?>" />
<?php } ?>
 
二.app文件 3处:/app/explore/main.php 
 
if ($category_info) { 的上面添加
TPL::assign('canonical_url', get_js_url('/')); //增加本页唯一地址显示
 
在 if ($category_info) { 内部的 TPL::set_meta('description', $meta_description);下面添加
TPL::assign('canonical_url', get_js_url('/explore/' . $category_info['id'])); //增加本页唯一地址显示
 
在 TPL::output('explore/index'); 的上面添加
        if ($_GET['day'] or $_GET['is_recommend']) {
            TPL::assign('canonical_url', get_js_url('/' . preg_replace("/[\(\)\.;']/", '', $_GET['sort_type']) . '' . $category_info['id'] . '' . intval($_GET['day']) . '' . intval($_GET['is_recommend'])) . '.html'); //增加本页唯一地址显示
        }
 
---------------修改完毕-----------
只修改了首页,其它页的方法也差不多是这个思路,大家可以参考着改。如发现bug请回复到这里。                        
                    
 
                                         
                 
                 
                 
                
2016-06-10 21:45
2016-06-10 21:17