[通用] Facebook分享縮圖優化
https://besv.net/thread-1484-1-1.html
http://www.kerobbs.net/thread-20506-1-1.html
修改風格檔/template/風格資料夾/common/header_common.htm(若有)
若無則修改/template/default/common/header_common.htm
找到
- <meta http-equiv="MSThemeCompatible" content="Yes" />
複製代碼 下面增加
- <!--{if $_G[tid]}-->
- <meta property="og:site_name" content="$_G['setting']['bbname']"/>
- <!--{if in_array('forum_viewthread', $_G['setting']['rewritestatus'])}-->
- <meta property="og:url" content="$_G[siteurl]thread-{$_G[tid]}-1-1.html"/>
- <!--{else}-->
- <meta property="og:url" content="$_G[siteurl]forum.php?mod=viewthread&tid=$_G[tid]"/>
- <!--{/if}-->
- <meta property="og:title" content="$_G[forum_thread][subject] - $_G['setting']['bbname']"/>
- <meta property="og:description" content="{if !empty($metadescription)}{echo htmlspecialchars($metadescription)}{/if}"/>
- <!--{/if}-->
-
- <!--{eval $ogImageStop = false; $key = 0;}-->
- <!--{loop $postlist $post}-->
- <!--{loop $post['attachments'] $attachment}-->
- <!--{if $attachment['isimage']}-->
- <!--{eval $key++}-->
- <!--{if $key < 2}-->
- <meta property="og:image" content="{$_G['siteurl']}{$attachment['url']}{$attachment['attachment']}">
- <!--{/if}-->
- <!--{eval $ogImageStop = true;}-->
- <!--{/if}-->
- <!--{/loop}-->
- <!--{/loop}-->
- <!--{if $_SERVER['PHP_SELF'] == '/forum.php'}-->
- <meta property="og:image" content="網站代表logo網址" />
- <!--{/if}-->
複製代碼功能就是讓Facebook和Google+能抓到論壇的正確訊息及縮圖,
縮圖若有圖片附件則以第一張圖片附件為主,
若無則以指定的論壇LOGO顯示。 |
|
|
|