Authored by 郝肖肖

Merge branch 'hotfix/baiduJsonLd' into feature/backDown

... ... @@ -307,11 +307,12 @@ const index = (req, res, next) => {
isShare: isShare,
id: id,
showAnaJson: {
miptitle: data.title,
mipPublishTime: guang.detail.publishTime,
mipPics: [mipPic],
mipDes: guang.shareDesc,
mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
addBaiduSite: true,
title: data.title,
publishTime: guang.detail.publishTime,
pic: mipPic,
des: guang.shareDesc,
url: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
}
}, data, parameter));
})().catch(next);
... ...
... ... @@ -216,13 +216,12 @@ const detailIndex = (req, res, next) => {
currentHref: `https://m.yohobuy.com/guang/${id}.html`
},
showAnaJson: {
miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
mipId: id,
mipPublishTime: mipPublishTime,
mipPics: [mipPic],
mipDes: detail.getArticle.article_summary,
mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html`
addBaiduSite: false,
title: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
publishTime: mipPublishTime,
pic: mipPic,
des: detail.getArticle.article_summary,
url: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
}
}, data));
})().catch(next);
... ...
... ... @@ -58,16 +58,12 @@ const newDetail = {
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' +
JSON.stringify(appParams) +
'}';
let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => {
return item.img.replace(/\?(.*)/g, '?imageView2/{mode}/w/{width}/h/{height}');
});
let mipPic = _.get(result, 'bannerTop.list[0].img', '');
if (mipPics.length <= 0) {
mipPics.push(_.get(result, 'bannerTop.img', '').replace(
/\?(.*)/g,
'?imageView2/{mode}/w/{width}/h/{height}'
));
}
mipPic = (mipPic ? mipPic : _.get(result, 'bannerTop.img', '')).replace(
/\?(.*)/g,
'?imageView2/{mode}/w/{width}/h/{height}'
);
let title = `【${result.brandName}${result.sortName}${result.goodsName}|YOHO!BUY 有货`;
let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' +
... ... @@ -89,11 +85,12 @@ const newDetail = {
appPath: appPath,
isMarsApp: req.yoho.isMarsApp, // 判断mars
showAnaJson: {
miptitle: title,
mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
mipPics: mipPics.slice(0, 5),
mipDes: description,
mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
addBaiduSite: true,
title: title,
publishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
pic: mipPic,
des: description,
url: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
},
miniPath: helpers.urlFormat('/api/wechat/miniapp.jpg', {
miniapp_type: 0,
... ...
{{# showAnaJson}}
{{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{{mipUrl}}",
"@id": "{{url}}",
"appid": "1583402501013173",
"title": "{{miptitle}}",
"title": "{{title}}",
"images": [
{{# mipPics}}
{{#isEqualOr @index 0}}
{{#if .}}"http:{{image . 750 500 1}}"{{/if}}
{{else}}
{{#if .}},"http:{{image . 750 500 1}}"{{/if}}
{{/isEqualOr}}
{{/mipPics}}
{{#if pic}}"http:{{image pic 750 500 1}}"{{/if}}
],
"description": "{{mipDes}}",
"pubDate": "{{mipPublishTime}}"
"description": "{{des}}",
"pubDate": "{{publishTime}}"
}
</script>
{{/showAnaJson}}
... ...