Home  >  Article  >  CMS Tutorial  >  How to optimize the link of dedecms column list page

How to optimize the link of dedecms column list page

藏色散人
藏色散人Original
2019-12-10 09:53:212175browse

How to optimize the link of dedecms column list page

dedecms How to optimize the link to the column list page?

The Dedecms program does a better job of SEO search engine optimization and is very flexible. But there are still some details that we need to discover, modify, and use flexibly, such as the optimization of pagination links in the DEDECMS column list.

Recommended study: 梦Weavercms

dedecms default column list paging link:

<li><a href="list_4_1.html">首页</a></li> 
<li><a href="list_4_3.html">上一页</a></li> 
<li><a href="list_4_1.html">1</a></li> 
<li><a href="list_4_2.html">2</a></li> 
<li><a href="list_4_3.html">3</a></li> 
<li class="thisclass">4</li> 
<li><a href="list_4_5.html">5</a></li> 
<li><a href="list_4_5.html">下一页</a></li> 
<li><a href="list_4_5.html">末页</a></li>

This connection method is very unusual Reasonable, for SEO has unintentionally dispersed the column page weight, the effect we want is to modify list_4_1.html to /a/ The following connection method is reasonable:

<li><a href="/a/">首页</a></li> 
<li><a href="list_4_3.html">上一页</a></li> 
<li><a href="/a/">1</a></li> 
<li><a href="list_4_2.html">2</a></li> 
<li><a href="list_4_3.html">3</a></li> 
<li class="thisclass">4</li> 
<li><a href="list_4_5.html">5</a></li> 
<li><a href="list_4_5.html">下一页</a></li> 
<li><a href="list_4_5.html">末页</a></li>

Modification method

1. Find the file \include\arc.listview.class.php and add the following code in front of "//Get links to the previous page and homepage";

$typedir= ereg_replace('{cmspath} ',$GLOBALS['cfg_cmspath'],$this->Fields['typedir']);

2. Find the lines of code below "//Get links to the previous page and homepage".

if($this->ageNo != 1) 
{ 
$prepage.=”<li><a href=’”.str_replace(“{page}”,$prepagenum,$tnamerule).”‘>上一页</a></li>rn”; 
$indexpage=”<li><a href=’”.str_replace(“{page}”,1,$tnamerule).”‘>首页</a></li>rn”; 
} 
-------------------把上面代码改成--------------------- 
if($this->ageNo != 1) 
{ 
if($prepagenum==1) 
{ 
$prepage.=”<li><a href=”".$typedir.”/”>上一页</a></li>rn”; 
} 
else 
{ 
$prepage.=”<li><a href=”".str_replace(“{page}”,$prepagenum,$tnamerule).””>上一页</a></li>rn”; 
} 
$indexpage=”<li><a href=”".$typedir.”/”>首页</a></li>rn”; 
}

Find

$listdd.=”<li><a href=’”.str_replace(“{page}”,$j,$tnamerule).”‘>”.$j.”</a></li>rn”; 
---------------------改成-------------------------- 
if($j==1) 
{ 
$listdd.=”<li><a href=”".$typedir.”/”>”.$j.”</a></li>rn”; 
} 
else 
{ 
$listdd.=”<li><a href=”".str_replace(“{page}”,$j,$tnamerule).””>”.$j.”</a></li>rn”; 
}

If you need to modify the paging style, modify it in the above code, such as deleting 25edfb22a4f469ecb59f1190150159c6

After this modification, list_4_1.html will no longer appear Such links are directly linked to addresses such as /abc/. Although this is just a small detail modification, the role small details sometimes play cannot be underestimated. This change ensures that the links back to the default list page avoid the loss of weight and is more in line with SEO practices.

The above is the detailed content of How to optimize the link of dedecms column list page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn