網站想要更好的SEO,就要把最基礎的一些小優化標籤做好,圖片添加alt標籤能搜尋引擎增加識別用,優化SEO。
修改/template/default/forum/discuzcode.htm文件
找到以下位置
1 2 3 4 5 6 7 |
<div class="mbn savephotop"> <!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}--> <a href="javascript:;"><img id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/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¬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}" alt="$attach[imgalt]" title="$attach[imgalt]" w="$attach[width]" /></a> <!--{else}--> <img id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬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 alt="$attach[imgalt]" title="$attach[imgalt]" w="$attach[width]" /> <!--{/if}--> </div> |
修改成
1 2 3 4 5 6 7 |
<div class="mbn savephotop"> <!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}--> <a href="javascript:;"><img id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/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¬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}" alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " w="$attach[width]" /></a> <!--{else}--> <img id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬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 alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " w="$attach[width]" /> <!--{/if}--> </div> |
其實就是把 alt="$attach[imgalt]" title="$attach[imgalt]" 改成了
1 |
alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " |
$_G[forum_thread][subject]- $_G[setting][sitename] 這個標籤的意思是 帖子標題-網站名稱
繼續修改下一個位置, 找到以下內容
1 2 3 4 5 |
<!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}--> <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} style="cursor:pointer" id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none-1.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¬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} /> <!--{else}--> <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none-1.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬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} /> <!--{/if}--> |
修改成
1 2 3 4 5 |
<!--{if $_G['setting']['thumbstatus'] && $attach['thumb']}--> <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} style="cursor:pointer" id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none-1.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¬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}" alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} /> <!--{else}--> <img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} id="aimg_$attach[aid]" aid="$attach[aid]" src="http://eric0703.pentaxfans.net/wp-content/uploads/2019/01/none-1.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬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 alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " id="aimg_$attach[aid]" inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} /> |
其實就是多增加了這個段code
1 |
alt="$_G[forum_thread][subject]- $_G[setting][sitename] " title="$_G[forum_thread][subject]- $_G[setting][sitename] " |