在 Dedecms 的栏目列表分页中,可能会出现两个内容相同但 URL 不同的情况:
一个是在其他页面链接的栏目首页 URL:www.xxx.com/lanmu1/index.html
另一个是栏目分页生成的链接 URL:www.xxx.com/lanmu1/list_1_1.html
这种现象对 SEO 并不友好,因此我们需要通过以下方法统一这两个 URL 为 index.html。
### 具体步骤如下:
#### 第一步:
找到文件 include/arc.listview.class.php,并在注释“//获得上一页和主页的链接”之前添加以下代码:
$typedir = ereg_replace('{cmspath}', $GLOBALS['cfg_cmspath'], $this->Fields['typedir']);
接着,在“//获得上一页和主页的链接”下方找到以下代码段:
将其修改为:
if($this->PageNo != 1) {
if($prepagenum == 1) {
$prepage .= "上一页 ";
} else {
$prepage .= "上一页 ";
}
$indexpage = "首页 ";
}
继续查找以下代码:
$listdd .= "" . $j . " ";
if($j == 1) {
$listdd .= "" . $j . " ";
} else {
$listdd .= "" . $j . " ";
}
希望这篇文章能够帮助到正在使用 Dedecms 的朋友们!如果您还有其他疑问,欢迎随时交流。