在当今互联网时代,网站建设已经成为企业、个人展示自身形象、传播信息的重要手段。而DedeCMS作为一款功能强大、易于使用的开源内容管理系统,受到了广大用户的喜爱。在DedeCMS中,标题长度设置是一个不容忽视的问题,它直接关系到网站的SEO优化和用户体验。本文将深入探讨DedeCMS标题长度设置的重要性,以及如何进行优化。
一、DedeCMS标题长度设置的重要性
1. SEO优化
SEO(搜索引擎优化)是提高网站在搜索引擎中排名、增加网站流量的重要手段。在DedeCMS中,标题是搜索引擎抓取的关键信息之一。一个合适的标题长度,既能满足搜索引擎的要求,又能吸引访客点击,从而提高网站权重和流量。
2. 用户体验
用户体验是衡量网站质量的重要指标。一个简洁、明了的标题,能够帮助访客快速了解文章或产品内容,提高用户体验。反之,过长的标题会让人感到繁琐,降低用户体验。
二、DedeCMS标题长度设置的标准
1. 搜索引擎要求
根据搜索引擎的规定,标题长度一般不超过60个字符。超过这个长度,搜索引擎可能会截断标题,导致信息不完整。
2. 用户体验要求
从用户体验的角度来看,标题长度控制在20-30个字符为宜。这个长度既能满足搜索引擎的要求,又能让访客快速了解文章或产品内容。
三、DedeCMS标题长度设置方法
1. 自定义标题长度
在DedeCMS后台,可以通过以下步骤自定义标题长度:
(1)进入DedeCMS后台,点击“系统设置”;
(2)选择“系统参数”;
(3)找到“标题长度”选项,输入所需的长度(建议20-30个字符);
(4)点击“保存”按钮。
2. 优化标题长度
在编写文章或产品标题时,可以采取以下方法优化标题长度:
(1)精简关键词:将标题中的冗余关键词删除,保留核心关键词;
(2)使用短句:将长句拆分成短句,提高标题的简洁性;
(3)使用符号:适当使用破折号、冒号等符号,使标题更具吸引力。
四、DedeCMS标题长度设置案例分析
以下是一个DedeCMS标题长度设置的案例分析:
| 原标题 | 优化后标题 | 说明 |
|---|---|---|
| 电脑维修服务,专业、快速、实惠 | 电脑维修,专业快速,实惠有保障 | 删除冗余关键词,使用短句,增加吸引力 |
| DedeCMS教程,从入门到精通 | DedeCMS教程,入门到精通 | 精简关键词,使用短句,提高可读性 |
DedeCMS标题长度设置是网站SEO优化和用户体验的关键。通过合理设置标题长度,可以提高网站在搜索引擎中的排名,吸引更多访客,从而提升网站的整体质量。在实际操作中,我们可以根据搜索引擎要求和用户体验,灵活调整标题长度,以达到最佳效果。
希望本文对您有所帮助,如果您还有其他关于DedeCMS标题长度设置的问题,欢迎在评论区留言交流。
织梦cms文章标题长度被截取怎么解决
dedecms限制标题长度加省略号的修改方法大家都知道,有时候,网页文章的标题太长的时候,会影响网页的美观,所以我们要对它进行修剪,限制它只显示多少个文字,多出来的部分用省略号代替.
1、修改CSS的:<a style=”width:120px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;” href=”xxxxx”网页文章很长很长很长很长的标题</a解释:width:120px;限定长度,text-overflow:ellipsis:当对象内文本溢出时显示省略标记…,white-space:nowrap:强制文本在一行内显示,overflow:hidden:溢出内容为隐藏。修改CSS的方法简单,不过很遗憾,text-overflow:ellipsis属性在firefox中是没有效果的。
2、修改模板的方法:用 [field:title function=’( strlen(”@me”)30? cn_substr(”@me”,30).”…”:“@me”)‘/]代替了原来的 [field:title/],在输出标题时多了一个判断的过程,先判断标题是否大于30字节,如果大于则只输出30字节的长度,并加上省略号。而title=” [field:title/]”则不受影响,鼠标移上去时显示标题的全部内容。
3、改dedecms程序方法:增加一个fulltitle标签,让你的title=显示完整标题具体修改如下:
1、打开include目录下inc目录下的inc_fun_SpGetArcList.php文件
2、找到228行Copy code$row['title']= cn_substr($row['title'],$titlelen);在前面增加一行$row['fulltitle']=$row['title'];//注释:显示完整标题3、找到$row['textlink']=”<a href='”.$row['filename'].”'”.$row['title'].”</a”;将其替换为:
dedecms列表页如何调用子栏目列表以及子栏目的名称
dedecms栏目名称的调用方法:{dede:field name=”typename”}调用当前栏目的名称
{dede:channel type='son' row='5'}<a href=”[field:typeurl/]”>[field:typename/]</a>{/dede:channel}调用该顶级频道下所有字栏目,row代表调用5条
{dede:type typeid='栏目id'}<a href=”[field:typeurl/]”>[field:typename/]</a>{/dede:type}表示调用指定id的栏目,只能调用一个。
{dede:channel type='top'}<a>[field:typename/]</a>{/dede:channel}调用子栏目的当前顶级栏目名称。
调用顶级栏目名称示例代码:
{dede:field.titlerunphp=’yes’}list($toptype,$sontype)=split(‘/’,@me);@me=$toptype;{/dede:field.title}
dedecms也叫织梦内容管理系统,是一款知名的PHP开源网站内容管理系统,以简单、实用、开源而闻名,DedeCms免费版的主要目标用户在个人站长,功能更专注于个人网站或中小型门户的构建,当然也不乏有企业用户和学校等在使用。
dedecms 列表点击加载更多读取数据库内容怎么实现
使用方法:
1、加载是用AJAX,需要先引用jQuery
2、模板在arcajax.php第二十八行请自行按需修改
3、arcajax.php放到plus目录下
HTML和js代码:
<divid=”loading27″>加载中</div>
<ahref=”javascript:;”id=”getMore”pnum=”2″class=”index-morebgwmt15″>浏览更多案例……</a>
<scripttype=”text/javascript”>
$(“#getMore”).click(function(){
var_this=$(this),
pnum=_this.attr(“pnum”),//分页码
typeid=1;//栏目ID
if(pnum==0){
returnfalse;
}
$(“#loading27”).show();
$.ajax({
url:'/plus/arcajax.php',
data:{typeid:typeid,pnum:pnum},
success:function(data){
if(data!=''){
$(“.index-list”).append(data);//数据显示到页面
_this.attr(“pnum”,Number(pnum)+1);//分页+1
}else{
_this.text(“没有更多的数据”);
_this.attr(“pnum”,0)
}
$(“#loading27”).hide();
}
})
returnfalse;
})
</script>
PHP代码(arcajax.php):
<?php
require_once(dirname(__FILE__).”/../include/common.inc.php”);
require_once(DEDEINC.'/channelunit.class.php');
require_once(DEDEINC.'/taglib/arcpagelist.lib.php');
$pnum=empty($pnum)?0:intval(preg_replace(“/[^\d]/”,'',$pnum));
$typeid=empty($typeid)?0:intval(preg_replace(“/[^\d]/”,'',$typeid));
if($typeid==0||$pnum==0)die(“RequestError!”);
if($typeid>0)
{
$titlelen=AttDef($titlelen,30);
$infolen=AttDef($infolen,160);
$imgwidth=AttDef($imgwidth,120);
$imgheight=AttDef($imgheight,120);
$listtype=AttDef($listtype,'all');
$arcid=AttDef($arcid,0);
$channelid=AttDef($channelid,0);
$orderby=AttDef($orderby,'default');
$orderWay=AttDef($order,'desc');
$subday=AttDef($subday,0);
$line=$row;
$artlist='';
//通过页面及总数解析当前页面数据范围
$strnum=($pnum-1)*12;
$limitsql=”LIMIT$strnum,12″;
$innertext='<li[field:globalname=”autoindex”runphp=”yes”]if(@me%3==0)@me=\'class=”mrnone”\';else@me=””;[/field:global]>
<div><ahref=”[field:arcurl/]”title=”[field:title/]”><imgsrc=”[field:litpic/]”width=”278″height=”245″></a></div>
<h3><ahref=”[field:arcurl/]”title=”[field:title/]”>[field:title/]</a></h3>
<p>[field:descriptionfunction=”cn_substr(@me,150)”/]</p>
<spanclass=”more”><ahref=”[field:arcurl/]”>浏览案例</a></span>
</li>';//模板
//处理列表内容项
$query=”SELECTarc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,
tp.moresite,tp.siteurl,tp.sitepathFROM`#@__archives`arcLEFTJOIN`#@__arctype`tpONarc.typeid=tp.id
WHEREarc.typeidIN(“.GetSonIds($typeid).”)ORDERBYarc.sortrankdesc$limitsql”;
$dsql->SetQuery($query);
$dsql->Execute('al');
$dtp2=newDedeTagParse();
$dtp2->SetNameSpace('field','[',']');
$dtp2->LoadString($innertext);
$GLOBALS['autoindex']=0;
$ids=array();
for($i=0;$i<12;$i++)
{
for($j=0;$j<1;$j++)
{
if($row=$dsql->GetArray(“al”))
{
$ids[]=$row['id'];
//处理一些特殊字段
$row['info']=$row['infos']=cn_substr($row['description'],$infolen);
$row['id']=$row['id'];
if($row['corank']>0&&$row['arcrank']==0)
{
$row['arcrank']=$row['corank'];
}
$row['filename']=$row['arcurl']=GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
$row['typeurl']=GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],
$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);
if($row['litpic']=='-'||$row['litpic']=='')
{
$row['litpic']=$GLOBALS['cfg_cmspath'].'/images/defaultpic.gif';
}
if(!preg_match(“#^http:\/\/#”,$row['litpic'])&&$GLOBALS['cfg_multi_site']=='Y')
{
$row['litpic']=$GLOBALS['cfg_mainsite'].$row['litpic'];
}
$row['picname']=$row['litpic'];
$row['stime']=GetDateMK($row['pubdate']);
$row['typelink']=”<ahref='”.$row['typeurl'].”'>”.$row['typename'].”</a>”;
$row['image']=”<imgsrc='”.$row['picname'].”'border='0'width='$imgwidth'height='$imgheight'alt='”.preg_replace(“#['><]#”,””,$row['title']).”'>”;
$row['imglink']=”<ahref='”.$row['filename'].”'>”.$row['image'].”</a>”;
$row['fulltitle']=$row['title'];
$row['title']=cn_substr($row['title'],$titlelen);
if($row['color']!='')$row['title']=”<fontcolor='”.$row['color'].”'>”.$row['title'].”</font>”;
if(preg_match('#b#',$row['flag']))$row['title']=”<strong>”.$row['title'].”</strong>”;
//$row['title']=”<b>”.$row['title'].”</b>”;
$row['textlink']=”<ahref='”.$row['filename'].”'>”.$row['title'].”</a>”;
$row['plusurl']=$row['phpurl']=$GLOBALS['cfg_phpurl'];
$row['memberurl']=$GLOBALS['cfg_memberurl'];
$row['templeturl']=$GLOBALS['cfg_templeturl'];
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTagsas$k=>$ctag)
{
if($ctag->GetName()=='array')
{
//传递整个数组,在runphp模式中有特殊作用
$dtp2->Assign($k,$row);
}else{
if(isset($row[$ctag->GetName()]))$dtp2->Assign($k,$row[$ctag->GetName()]);
else$dtp2->Assign($k,'');
}
}
$GLOBALS['autoindex']++;
}
$artlist.=$dtp2->GetResult().”
“;
}//ifhasRow
else{
$artlist.='';
}
}//LoopCol
}//loopline
$dsql->FreeResult(“al”);
}else
{
die(“RequestError!”);
}
AjaxHead();
echo$artlist;
exit();




