Authored by 郭成尧

Merge branch 'feature/seo2' of git.yoho.cn:fe/yohobuywap-node into feature/seo2

... ... @@ -86,17 +86,20 @@ const _relatedTag = (tags, isApp) => {
*/
const _relatedInfo = (getOtherArticle, isApp) => {
let relatedInfo = [];
let articleUrl;
getOtherArticle.forEach(value => {
articleUrl = helpers.urlFormat('/info/index', {
id: value.id
}, 'guang');
if (isApp) {
value.url = articleUrl + '&openby:yohobuy={"action":"go.h5","params":{"id":"' + value.id + '","shareparam":{"id":"' + value.id + '"},"islogin":"N","type":1,"url":"http://guang.m.yohobuy.com/info/index","param":{"id":"' + value.id + '"}}}';
if (value.url.indexOf('guang.m.yohobuy.com') < 0) {
value.url = `${helpers.https(value.url)}?openby:yohobuy={"url":"${value.url}","islogin":"N"}}`;
} else {
value.url = `//m.yohobuy.com/guang/info/${value.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${value.id}"},"shareparam":{"id":"${value.id}"},"share":"/guang/api/v1/share/guang","id":${value.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${value.id}.html","islogin":"N"}}`;
}
} else {
value.url = articleUrl;
if (value.url.indexOf('guang.m.yohobuy.com') < 0) {
value.url = value.url;
} else {
value.url = `//m.yohobuy.com/guang/info/${value.id}.html`;
}
}
value.thumb = helpers.image(value.thumb, 279, 175);
... ...
... ... @@ -79,11 +79,11 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => {
if (!articleData.id) {
return false;
}
let result = {
id: articleData.id,
showTags: showTag,
img: articleData.src ? helpers.image(articleData.src, 640, 640) : '',
url: isApp ? `//m.yohobuy.com/guang/info/${articleData.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${articleData.id}"},"shareparam":{"id":"${articleData.id}"},"share":"/guang/api/v1/share/guang","id":${articleData.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${articleData.id}.html","islogin":"N"}}` : `//m.yohobuy.com/guang/info/${articleData.id}.html`, //eslint-disable-line
title: articleData.title,
text: articleData.intro,
publishTime: articleData.publish_time,
... ... @@ -91,6 +91,20 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => {
pageView: articleData.views_num
};
if (isApp) {
if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) {
result.url = `${helpers.https(articleData.url)}?openby:yohobuy={"url":"${articleData.url}","islogin":"N"}}`;
} else {
result.url = `//m.yohobuy.com/guang/info/${articleData.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${articleData.id}"},"shareparam":{"id":"${articleData.id}"},"share":"/guang/api/v1/share/guang","id":${articleData.id},"type":1,"url":"http://m.yohobuy.com/guang/info/${articleData.id}.html","islogin":"N"}}`;
}
} else {
if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) {
result.url = articleData.url;
} else {
result.url = `//m.yohobuy.com/guang/info/${articleData.id}.html`;
}
}
if (result.url.includes('feature.yoho.cn') ||
result.url.includes('cdn.yoho.cn')) {
result.url = transHttpsUrl(result.url);
... ...
... ... @@ -237,7 +237,7 @@ exports.processProductList = (list, options) => {
product.seoTitle = `${product.brand_name}|${seoGender}${product.small_sort_name}|${product.product_name}|YOHO!BUY有货`; // eslint-disable-line
product.imgAlt = _.compact([product.brand_name, (product.gender ? GENDER[product.gender] : false), product.small_sort_name, product.product_name]).join('|');
product.imgAlt = _.compact([product.brand_name, (product.gender ? GENDER[product.gender] : false), product.small_sort_name, product.product_name]).join('|'); // eslint-disable-line
pruductList.push(product);
});
... ...