1. 赤狐铭创首页
  2. SEO排名优化

SEO优化 Discuz! x3论坛系统全站加图片alt属性的优化方法

打开/template/default/forum/discuzcode.htm

搜索 {if $attach[‘price’] && $_G[‘forum_attachmentdown’]
找到以下代码

  1. <img{if $attach[‘price’] && $_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]} class=”attprice”{/if} id=”aimg_$attach[aid]” aid=”$attach[aid]” src=”{STATICURL}image/common/none.gif” onclick=”zoom(this, this.getAttribute(‘zoomfile’), 0, 0, ‘{$_G[setting][showexif]}’)” zoomfile=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes&#172;humb=yes{else}{$attach[url]}$attach[attachment]{/if}” file=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}” inpost=”1″ {if $_GET[‘from’] != ‘preview’} onmouseover=”showMenu({‘ctrlid’:this.id,’pos’:’12’})”{/if} />
  2.                                         <!–{else}–>
  3.                                                 <img{if $attach[‘price’] && $_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]} class=”attprice”{/if} id=”aimg_$attach[aid]” aid=”$attach[aid]” src=”{STATICURL}image/common/none.gif” zoomfile=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes&#172;humb=yes{else}{$attach[url]}$attach[attachment]{/if}” file=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}” $widthcode id=”aimg_$attach[aid]” inpost=”1″ {if $_GET[‘from’] != ‘preview’} onmouseover=”showMenu({‘ctrlid’:this.id,’pos’:’12’})”{/if} />

 

替换为:

  1. <img{if $attach[‘price’] && $_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]} class=”attprice”{/if} id=”aimg_$attach[aid]” aid=”$attach[aid]” src=”{STATICURL}image/common/none.gif” onclick=”zoom(this, this.getAttribute(‘zoomfile’), 0, 0, ‘{$_G[setting][showexif]}’)” zoomfile=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes&#172;humb=yes{else}{$attach[url]}$attach[attachment]{/if}” file=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}” inpost=”1″ alt=”$_G[forum_thread][subject] – $_G[setting][sitename] – $attach[imgalt]” title=”$_G[forum_thread][subject] – $_G[setting][sitename] – $attach[imgalt]” {if $_GET[‘from’] != ‘preview’} onmouseover=”showMenu({‘ctrlid’:this.id,’pos’:’12’})”{/if} />
  2.                                         <!–{else}–>
  3.                                                 <img{if $attach[‘price’] && $_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]} class=”attprice”{/if} id=”aimg_$attach[aid]” aid=”$attach[aid]” src=”{STATICURL}image/common/none.gif” zoomfile=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes&#172;humb=yes{else}{$attach[url]}$attach[attachment]{/if}” file=”{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}” $widthcode id=”aimg_$attach[aid]” inpost=”1″ alt=”$_G[forum_thread][subject] – $_G[setting][sitename] – $attach[imgalt]” title=”$_G[forum_thread][subject] – $_G[setting][sitename] – $attach[imgalt]” {if $_GET[‘from’] != ‘preview’} onmouseover=”showMenu({‘ctrlid’:this.id,’pos’:’12’})”{/if} />

 

然后登陆后台,更新缓存即可。代码调用的依次是标题、站点名称及图片名称,可以修改。

文章发布者:老祺,转载请注明出处:https://vip.chihumc.com/918.html

发表评论

登录后才能评论

联系我们

133-2020-1935

在线咨询:点击这里给我发消息

邮件:chihumc@foxmail.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code