首页 > 动易 > 去掉顶部频道显示处的网站首页及频道地址的扩展名

去掉顶部频道显示处的网站首页及频道地址的扩展名

2008年1月11日 阵风 发表评论 阅读评论

大部分情况下,http://www.zhangzhenfeng.com/ 与 http://www.zhangzhenfeng.com/index.asp 的 Google PageRank 是不同的。据说,在google 看来,目录的权重比文件大。默认情况下,动易的标签 {$ShowChannel} 输出时,网站首页、频道首页的地址都是{$InstallDir}index.htm、{$InstallDir}Article/index.asp 的形式,如何才能修改为 {$InstallDir}、{$InstallDir}Article/ 的形式呢?

只需修改 Include/PowerEasy.Common.Front.asp 中的Function GetChannelList(NumNewLine),进而改变标签 {$ShowChannel} 的输出即可。下面以动易开源版SiteWeaver™ CMS 6.5为例进行说明。

第一步,将网站首页地址由 {$InstallDir}index.htm 的形式修改为 {$InstallDir} 的形式。在 Include/PowerEasy.Common.Front.asp 中找到如下代码:

If ChannelID = 0 Then
strChannel = ChannelLink & “<a class=”Channel2” href=”” & strInstallDir & FileName_SiteIndex & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
Else
strChannel = ChannelLink & “<a class=”Channel” href=”” & strInstallDir & FileName_SiteIndex & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
End If

将其修改为

If ChannelID = 0 Then
strChannel = ChannelLink & “<a class=”Channel2” href=”” & strInstallDir  & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
Else
strChannel = ChannelLink & “<a class=”Channel” href=”” & strInstallDir & “”>” & XmlText(“BaseText”, “FirstPage”, “网站首页”) & “</a>” & ChannelLink
End If

第二步,将频道首页地址由 {$InstallDir}Article/index.htm 的形式修改为 {$InstallDir}Article/ 的形式。在 Include/PowerEasy.Common.Front.asp 中找到如下代码:

If rsChannel(“UseCreateHTML”) > 0 Then
strChannel = strChannel & ” href=”” & ChannelUrl & “/Index” & arrFileExt(rsChannel(“FileExt_Index”)) & “””
Else
strChannel = strChannel & ” href=”” & ChannelUrl & “/Index.asp””
End If

将其修改为

strChannel = strChannel & ” href=”” & ChannelUrl & “/””

修改完成后,保存文件,更新缓存,如果网站首页或某频道首页需要生成html,进行生成后刷新页面即可。另外,注意一下默认文档顺序(例如:网站首页生成html后缀为“.htm”,但默认文档中index.asp i优先于 index.htm,则访问网站目录 {$InstallDir} 时,系统会调用index.asp而非index.htm,然后跳转到index.htm,这种情况下地址栏显示的地址不是目录形式,多了个index.htm)

  1. PE Fans
    2010年8月9日17:56 | #1

    这个比较实用!

    • 2010年8月9日23:14 | #2

      现在很多人都直接用HTML代码写导航,不再直接调用数据库。不过,用”/”代替“/Index.html”这一点依然有用。

  1. 本文目前尚无任何 trackbacks 和 pingbacks.