Merge branch 'feature/seo2' into 'gray'
guang 链接变短 See merge request !1106
Showing
6 changed files
with
24 additions
and
9 deletions
@@ -92,13 +92,13 @@ const _relatedInfo = (getOtherArticle, isApp) => { | @@ -92,13 +92,13 @@ const _relatedInfo = (getOtherArticle, isApp) => { | ||
92 | if (value.url.indexOf('guang.m.yohobuy.com') < 0) { | 92 | if (value.url.indexOf('guang.m.yohobuy.com') < 0) { |
93 | value.url = `${helpers.https(value.url)}?openby:yohobuy={"url":"${value.url}","islogin":"N"}}`; | 93 | value.url = `${helpers.https(value.url)}?openby:yohobuy={"url":"${value.url}","islogin":"N"}}`; |
94 | } else { | 94 | } else { |
95 | - 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"}}`; | 95 | + value.url = `//m.yohobuy.com/guang/${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/${value.id}.html","islogin":"N"}}`; |
96 | } | 96 | } |
97 | } else { | 97 | } else { |
98 | if (value.url.indexOf('guang.m.yohobuy.com') < 0) { | 98 | if (value.url.indexOf('guang.m.yohobuy.com') < 0) { |
99 | value.url = value.url; | 99 | value.url = value.url; |
100 | } else { | 100 | } else { |
101 | - value.url = `//m.yohobuy.com/guang/info/${value.id}.html`; | 101 | + value.url = `//m.yohobuy.com/guang/${value.id}.html`; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
@@ -312,7 +312,7 @@ const indexRedirect = (req, res, next) => { | @@ -312,7 +312,7 @@ const indexRedirect = (req, res, next) => { | ||
312 | let id = req.query.id; | 312 | let id = req.query.id; |
313 | 313 | ||
314 | if (id) { | 314 | if (id) { |
315 | - let redirectUrl = '/guang/info/'; | 315 | + let redirectUrl = '/guang/'; |
316 | 316 | ||
317 | if (req.yoho.channel !== req.cookies._Channel) { | 317 | if (req.yoho.channel !== req.cookies._Channel) { |
318 | redirectUrl += `${req.yoho.channel}-`; | 318 | redirectUrl += `${req.yoho.channel}-`; |
@@ -261,9 +261,23 @@ module.exports = class extends global.yoho.BaseModel { | @@ -261,9 +261,23 @@ module.exports = class extends global.yoho.BaseModel { | ||
261 | data.url = data.url + ''; | 261 | data.url = data.url + ''; |
262 | } | 262 | } |
263 | 263 | ||
264 | + if (isApp) { | ||
265 | + if (data.url.indexOf('guang.m.yohobuy.com') < 0) { | ||
266 | + data.url = `${helpers.https(data.url)}?openby:yohobuy={"url":"${data.url}","islogin":"N"}}`; | ||
267 | + } else { | ||
268 | + data.url = `//m.yohobuy.com/guang/${data.id}.html?openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${data.id}"},"shareparam":{"id":"${data.id}"},"share":"/guang/api/v1/share/guang","id":${data.id},"type":1,"url":"http://m.yohobuy.com/guang/${data.id}.html","islogin":"N"}}`; | ||
269 | + } | ||
270 | + } else { | ||
271 | + if (data.url.indexOf('guang.m.yohobuy.com') < 0) { | ||
272 | + data.url = data.url; | ||
273 | + } else { | ||
274 | + data.url = `//m.yohobuy.com/guang/${data.id}.html`; | ||
275 | + } | ||
276 | + } | ||
277 | + | ||
264 | list.push({ | 278 | list.push({ |
265 | id: data.id, | 279 | id: data.id, |
266 | - url: isApp ? `${helpers.https(data.url)}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${data.id}"},"shareparam":{"id":"${data.id}"},"share":"/guang/api/v1/share/guang","id":${data.id},"type":1,"url":"http:${helpers.urlFormat('/info/index', null, 'guang')}","islogin":"N"}}` : data.url, // eslint-disable-line | 280 | + url: data.url, |
267 | title: data.title, | 281 | title: data.title, |
268 | text: data.intro, | 282 | text: data.intro, |
269 | img: helpers.image(data.src, 640, 640), | 283 | img: helpers.image(data.src, 640, 640), |
@@ -53,9 +53,9 @@ router.post('/opt/collectArticle', opt.collectArticle); // 资讯文章收藏 (H | @@ -53,9 +53,9 @@ router.post('/opt/collectArticle', opt.collectArticle); // 资讯文章收藏 (H | ||
53 | router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏 | 53 | router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏 |
54 | 54 | ||
55 | router.get('/info/index', rewrite.channel, detail.indexRedirect); // 逛详情页 | 55 | router.get('/info/index', rewrite.channel, detail.indexRedirect); // 逛详情页 |
56 | -router.get(/^\/info\/(.*?)\.html/, rewrite.resolve, mip, detail.index); // 逛详情页 SEO优化 | 56 | +router.get(/^\/info\/(.*?)\.html/, rewrite.resolve, mip, detail.indexRedirect); // 逛详情页 SEO优化 |
57 | 57 | ||
58 | -router.get('/:id.html', detail.index); // 逛详情页(兼容 PC 跳转过来的链接) | 58 | +router.get('/:id.html', mip, detail.index); // 逛详情页(兼容 PC 跳转过来的链接) |
59 | router.get('/info/mini', detail.mini); // 逛mini内容页 | 59 | router.get('/info/mini', detail.mini); // 逛mini内容页 |
60 | router.get('/info/foryoho', detail.foryoho); // 逛foryoho内容页 | 60 | router.get('/info/foryoho', detail.foryoho); // 逛foryoho内容页 |
61 | 61 |
@@ -16,5 +16,6 @@ const guang = require(`${cRoot}/guang`); | @@ -16,5 +16,6 @@ const guang = require(`${cRoot}/guang`); | ||
16 | router.use(mip); | 16 | router.use(mip); |
17 | 17 | ||
18 | router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex); | 18 | router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex); |
19 | +router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex); | ||
19 | 20 | ||
20 | module.exports = router; | 21 | module.exports = router; |
@@ -129,7 +129,7 @@ | @@ -129,7 +129,7 @@ | ||
129 | <div class="related-info"> | 129 | <div class="related-info"> |
130 | {{# relatedInfo}} | 130 | {{# relatedInfo}} |
131 | <div class="info-item"> | 131 | <div class="info-item"> |
132 | - <a data-type="mip" data-title="{{title}}" href="//m.yohobuy.com/mip/guang/info/{{id}}.html"> | 132 | + <a data-type="mip" data-title="{{title}}" href="//m.yohobuy.com/mip/guang/{{id}}.html"> |
133 | <div class="pic"> | 133 | <div class="pic"> |
134 | <mip-img class="pic-mip" width="117" height="73" src="{{thumb}}"> | 134 | <mip-img class="pic-mip" width="117" height="73" src="{{thumb}}"> |
135 | </mip-img> | 135 | </mip-img> |
@@ -95,13 +95,13 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => { | @@ -95,13 +95,13 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => { | ||
95 | if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) { | 95 | if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) { |
96 | result.url = `${helpers.https(articleData.url)}?openby:yohobuy={"url":"${articleData.url}","islogin":"N"}}`; | 96 | result.url = `${helpers.https(articleData.url)}?openby:yohobuy={"url":"${articleData.url}","islogin":"N"}}`; |
97 | } else { | 97 | } else { |
98 | - 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"}}`; | 98 | + result.url = `//m.yohobuy.com/guang/${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/${articleData.id}.html","islogin":"N"}}`; |
99 | } | 99 | } |
100 | } else { | 100 | } else { |
101 | if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) { | 101 | if (articleData.url.indexOf('guang.m.yohobuy.com') < 0) { |
102 | result.url = articleData.url; | 102 | result.url = articleData.url; |
103 | } else { | 103 | } else { |
104 | - result.url = `//m.yohobuy.com/guang/info/${articleData.id}.html`; | 104 | + result.url = `//m.yohobuy.com/guang/${articleData.id}.html`; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 |
-
Please register or login to post a comment