[收起] 文章目錄
返回頂部
- 適用 X2 、 X2.5
- 適用 X3
- 相關下載
站點圖片做 alt 信息對於 SEO 的優化還是挺重要的。
直接説方法吧!
要是懶得修改或者不會修改的,直接到下邊下載文件來進行修改吧!
打開自己站點的 /template/default/forum/discuzcode.htm 文件
查找 alt="$attach[imgalt]" title="$attach[imgalt]" ,這個有多個地方,大概是 6 處,找到的地方全部替換為
X2 、 x2.5 替換代碼
XHTML
|
1
|
alt="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" title="$_G[forum_thread][subject] - $_G[setting][sitename] - $attach[imgalt]" |
替換完了以後,保存即可。然後登錄後台,工具 - 更新緩存即可。
查找 alt=$attach['price'],大概在 258 行和 260 行,一共有兩個 $attach['price']
將 258-260 行,三行代碼替換成下面的
X3 - 258-260 行替換代碼
XHTML
|
1
2
3
|
<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="{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¬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} />
<!--{else}-->
<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¬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} /> |
替換完了以後,保存即可。然後登錄後台,工具 - 更新緩存即可。
注:以上兩個替換代碼的 alt 和 title 的顯示順序是:帖子標題-站點名稱-圖片名稱,這些可自行修改。這裏就不教如何修改了,自己看下代碼就知道了。