織夢程序文檔分享到微信后,不顯示縮略圖及摘要,給用戶帶來不好的體驗,不利于推廣及營銷。今天我們來介紹下織夢文章分享到微信帶縮略圖與簡介修改方法,完成這一個功能。
默認文章分享效果不顯示摘要和縮略圖:
通過教程修改之后效果:
準備工作
微信服務(wù)號一個,并且已經(jīng)通過了實名認證;
一個ICP備案的域名;
操作步驟
1、查看AppId,AppSecret以及綁定域名
2、文章內(nèi)容頁模板微信分享代碼
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script type="text/javascript">
var url = encodeURIComponent(location.href.split("#")[0]);
$.ajax({
type: "get",
url: "http://mengdiqiu.com.cn/wechat.php?link=" + url,
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function(e) {
var d = e.appid,
i = e.timestamp,
t = e.noncestr,
n = e.signature;
wx.config({
debug: 0,
appId: d,
timestamp: i,
nonceStr: t,
signature: n,
jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage"]
}),
wx.ready(function() {
wx.onMenuShareTimeline({
title: "{dede:field.title/}",
desc: "{dede:field.description/}",
link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}",
imgUrl: "{dede:global.cfg_basehost/}{dede:field.litpic/}"
}),
wx.onMenuShareAppMessage({
title: "{dede:field.title/}",
desc: "{dede:field.description/}",
link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}",
imgUrl: "{dede:global.cfg_basehost/}{dede:field.litpic/}"
})
})
}
});
</script>
溫馨提示:域名換成自己的域名
3、wechat.php文件下載,放在網(wǎng)站根目錄
鏈接:https://pan.baidu.com/s/1X5hAHu2VOyXrwjb5k4_RXw
提取碼:9825