Merge branch 'feature/globalDetailSeo' into feature/seo
Showing
5 changed files
with
129 additions
and
14 deletions
@@ -283,21 +283,31 @@ module.exports = class extends global.yoho.BaseModel { | @@ -283,21 +283,31 @@ module.exports = class extends global.yoho.BaseModel { | ||
283 | } | 283 | } |
284 | }); | 284 | }); |
285 | 285 | ||
286 | + let ht; | ||
287 | + | ||
286 | if (params.keywords) { | 288 | if (params.keywords) { |
287 | nav = [ | 289 | nav = [ |
288 | { | 290 | { |
289 | name: '搜索结果' | 291 | name: '搜索结果' |
290 | } | 292 | } |
291 | ]; | 293 | ]; |
294 | + | ||
295 | + ht = `${params.keywords}`; | ||
292 | } else { | 296 | } else { |
293 | nav = _this._getNav(params.id, menuData, params.url); | 297 | nav = _this._getNav(params.id, menuData, params.url); |
298 | + ht = _.last(nav).name; | ||
294 | } | 299 | } |
295 | 300 | ||
296 | return { | 301 | return { |
297 | nav: nav, | 302 | nav: nav, |
298 | data: { | 303 | data: { |
299 | menuData: menuData, | 304 | menuData: menuData, |
300 | - contData: contData | 305 | + contData: contData, |
306 | + seoData: { | ||
307 | + title: `有货${ht}-帮助中心-YOHO!BUY有货 100%正品保证`, | ||
308 | + keywords: `${ht},有货${ht},有货${ht}帮助中心`, | ||
309 | + description: `有货${ht}。YOHO!BUY有货帮助中心${ht}频道,提供有关${ht}相关问题解答。YOHO!BUY有货100%品牌正品保证,支持货到付款。` | ||
310 | + } | ||
301 | } | 311 | } |
302 | }; | 312 | }; |
303 | } | 313 | } |
@@ -20,14 +20,7 @@ const config = global.yoho.config; | @@ -20,14 +20,7 @@ const config = global.yoho.config; | ||
20 | */ | 20 | */ |
21 | const index = (req, res, next) => { | 21 | const index = (req, res, next) => { |
22 | let params = req.query; | 22 | let params = req.query; |
23 | - | ||
24 | - let resData = { | ||
25 | - title: '潮流商品搜索 | YOHO!BUY 有货', | ||
26 | - keywords: 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,' + | ||
27 | - '品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,' + | ||
28 | - 'new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流', | ||
29 | - description: '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜' | ||
30 | - }; | 23 | + let resData = {}; |
31 | 24 | ||
32 | search.getKeyActivity(params.query).then(activityUrl => { | 25 | search.getKeyActivity(params.query).then(activityUrl => { |
33 | if (activityUrl) { | 26 | if (activityUrl) { |
@@ -38,12 +31,20 @@ const index = (req, res, next) => { | @@ -38,12 +31,20 @@ const index = (req, res, next) => { | ||
38 | 31 | ||
39 | return search.getSearchData(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}), | 32 | return search.getSearchData(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}), |
40 | req.yoho.channel).then(result => { | 33 | req.yoho.channel).then(result => { |
34 | + let queryKey = req.query.query; | ||
35 | + | ||
41 | Object.assign(resData, result); | 36 | Object.assign(resData, result); |
42 | 37 | ||
43 | if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) { | 38 | if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) { |
44 | - _.set(resData, 'search.keyWord', req.query.query); | 39 | + _.set(resData, 'search.keyWord', queryKey); |
45 | return res.render('search/no-result', resData); | 40 | return res.render('search/no-result', resData); |
46 | } | 41 | } |
42 | + | ||
43 | + Object.assign(resData, { | ||
44 | + title: `${queryKey}价格_图片_品牌_怎么样-YOHO!BUY有货`, | ||
45 | + keywords: `${queryKey},${queryKey}价格,${queryKey}图片,${queryKey}怎么样,${queryKey}品牌,YOHO!BUY有货`, | ||
46 | + description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(resData, 'search.totalCount', 0)}条${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货` // eslint-disable-line | ||
47 | + }); | ||
47 | res.render('search/index', resData); | 48 | res.render('search/index', resData); |
48 | 49 | ||
49 | }); | 50 | }); |
@@ -140,6 +140,23 @@ const _handelGlobalSort = (origin, params, originParams) => { | @@ -140,6 +140,23 @@ const _handelGlobalSort = (origin, params, originParams) => { | ||
140 | }; | 140 | }; |
141 | }; | 141 | }; |
142 | 142 | ||
143 | +const _getProductSeoData = (detail) => { | ||
144 | + let resData = {}; | ||
145 | + | ||
146 | + if (!_.isEmpty(detail)) { | ||
147 | + let gn = detail.product_name, | ||
148 | + bn = _.get(detail, 'brand_info.brand_name') || detail.product_source; | ||
149 | + | ||
150 | + resData = { | ||
151 | + title: `${bn} | ${gn}正品 | YOHO!BUY 有货`, | ||
152 | + keywords: `${bn},${bn}官网专卖店,${bn}官方授权店,${bn}正品,${bn}打折,${bn}折扣店,${bn}真品,${bn}代购`, | ||
153 | + description: `YOHO!BUY 有货-${bn}官方授权店,${gn}图片、报价、介绍。YOHO!BUY 有货${bn}官网专卖店提供${bn}正品、${bn}真品、 ${bn}打折、${bn}代购等。` // eslint-disable-line | ||
154 | + }; | ||
155 | + } | ||
156 | + | ||
157 | + return resData; | ||
158 | +}; | ||
159 | + | ||
143 | const getGlobalProductListData = (params, yoho) => { | 160 | const getGlobalProductListData = (params, yoho) => { |
144 | let limitNum = params.limit ? params.limit - 1 : 59; | 161 | let limitNum = params.limit ? params.limit - 1 : 59; |
145 | let dps = {}; | 162 | let dps = {}; |
@@ -340,7 +357,7 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { | @@ -340,7 +357,7 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { | ||
340 | Object.assign(resData, result.header, { | 357 | Object.assign(resData, result.header, { |
341 | goodsInfo: detailInfo, | 358 | goodsInfo: detailInfo, |
342 | detailHtml: html || '' | 359 | detailHtml: html || '' |
343 | - }); | 360 | + }, _getProductSeoData(detailInfo)); |
344 | 361 | ||
345 | return resData; | 362 | return resData; |
346 | }); | 363 | }); |
@@ -333,7 +333,7 @@ exports.handleOptsData = (params, total, extra) => { | @@ -333,7 +333,7 @@ exports.handleOptsData = (params, total, extra) => { | ||
333 | }; | 333 | }; |
334 | 334 | ||
335 | // 用来标记是否是折扣专场,折扣专场只需要前三个排序参数 | 335 | // 用来标记是否是折扣专场,折扣专场只需要前三个排序参数 |
336 | - let count = (extra === 'discont') ? 3 : 4; | 336 | + let count = (extra === 'discont') ? 4 : 5; |
337 | 337 | ||
338 | for (let i = 0; i < count; i++) { | 338 | for (let i = 0; i < count; i++) { |
339 | let opt = {}; | 339 | let opt = {}; |
@@ -358,6 +358,24 @@ exports.handleOptsData = (params, total, extra) => { | @@ -358,6 +358,24 @@ exports.handleOptsData = (params, total, extra) => { | ||
358 | } | 358 | } |
359 | break; | 359 | break; |
360 | case 1: | 360 | case 1: |
361 | + if (params.order !== 'h_v_desc' && params.order !== 'h_v_asc') { | ||
362 | + opt.href = handleFilterUrl(params, {order: 'h_v_desc'}, {page: true}); | ||
363 | + opt.hasSortOrient = true; | ||
364 | + } else { | ||
365 | + opt.hasSortOrient = true; | ||
366 | + opt.active = true; | ||
367 | + if (params.order === 'h_v_desc') { | ||
368 | + opt.href = handleFilterUrl(params, {order: 'h_v_asc'}, {page: true}); | ||
369 | + opt.desc = false; | ||
370 | + } else { | ||
371 | + opt.href = handleFilterUrl(params, {order: 'h_v_desc'}, {page: true}); | ||
372 | + opt.desc = true; | ||
373 | + } | ||
374 | + } | ||
375 | + | ||
376 | + opt.name = '人气'; | ||
377 | + break; | ||
378 | + case 2: | ||
361 | if (params.order !== 's_t_desc' && params.order !== 's_t_asc') { | 379 | if (params.order !== 's_t_desc' && params.order !== 's_t_asc') { |
362 | opt.href = handleFilterUrl(params, {order: 's_t_desc'}, {page: true}); | 380 | opt.href = handleFilterUrl(params, {order: 's_t_desc'}, {page: true}); |
363 | opt.hasSortOrient = true; | 381 | opt.hasSortOrient = true; |
@@ -375,7 +393,7 @@ exports.handleOptsData = (params, total, extra) => { | @@ -375,7 +393,7 @@ exports.handleOptsData = (params, total, extra) => { | ||
375 | 393 | ||
376 | opt.name = '最新'; | 394 | opt.name = '最新'; |
377 | break; | 395 | break; |
378 | - case 2: | 396 | + case 3: |
379 | if (params.order !== 's_p_desc' && params.order !== 's_p_asc') { | 397 | if (params.order !== 's_p_desc' && params.order !== 's_p_asc') { |
380 | opt.href = handleFilterUrl(params, {order: 's_p_desc'}, {page: true}); | 398 | opt.href = handleFilterUrl(params, {order: 's_p_desc'}, {page: true}); |
381 | opt.hasSortOrient = true; | 399 | opt.hasSortOrient = true; |
@@ -393,7 +411,7 @@ exports.handleOptsData = (params, total, extra) => { | @@ -393,7 +411,7 @@ exports.handleOptsData = (params, total, extra) => { | ||
393 | 411 | ||
394 | opt.name = '价格'; | 412 | opt.name = '价格'; |
395 | break; | 413 | break; |
396 | - case 3: | 414 | + case 4: |
397 | if (params.order !== 'p_d_desc' && params.order !== 'p_d_asc') { | 415 | if (params.order !== 'p_d_desc' && params.order !== 'p_d_asc') { |
398 | opt.href = handleFilterUrl(params, {order: 'p_d_desc'}, {page: true}); | 416 | opt.href = handleFilterUrl(params, {order: 'p_d_desc'}, {page: true}); |
399 | opt.hasSortOrient = true; | 417 | opt.hasSortOrient = true; |
@@ -31,6 +31,75 @@ module.exports = [ | @@ -31,6 +31,75 @@ module.exports = [ | ||
31 | origin: '/new?order=s_t_desc&msort=10', | 31 | origin: '/new?order=s_t_desc&msort=10', |
32 | target: helpers.urlFormat('/lifestyle-new/', null, 'list') | 32 | target: helpers.urlFormat('/lifestyle-new/', null, 'list') |
33 | }, | 33 | }, |
34 | + // 男生销售类目一级菜单 | ||
35 | + { | ||
36 | + type: TYPE.redirect, | ||
37 | + origin: '/?gender=1,3&msort=1,3', | ||
38 | + target: helpers.urlFormat('/?category_id=5,8&gender=1,3', null, 'list') | ||
39 | + }, | ||
40 | + { | ||
41 | + type: TYPE.redirect, | ||
42 | + origin: '/?gender=1,3&msort=6', | ||
43 | + target: helpers.urlFormat('/?category_id=11&gender=1,3', null, 'list') | ||
44 | + }, | ||
45 | + { | ||
46 | + type: TYPE.redirect, | ||
47 | + origin: '/?gender=1,3&msort=7', | ||
48 | + target: helpers.urlFormat('/?category_id=14&gender=1,3', null, 'list') | ||
49 | + }, | ||
50 | + { | ||
51 | + type: TYPE.redirect, | ||
52 | + origin: '/?gender=1,3&msort=8', | ||
53 | + target: helpers.urlFormat('/?category_id=17&gender=1,3', null, 'list') | ||
54 | + }, | ||
55 | + // 女生销售类目一级菜单 | ||
56 | + { | ||
57 | + type: TYPE.redirect, | ||
58 | + origin: '/?gender=2,3&msort=1,3', | ||
59 | + target: helpers.urlFormat('/?category_id=18,31,25&gender=2,3', null, 'list') | ||
60 | + }, | ||
61 | + { | ||
62 | + type: TYPE.redirect, | ||
63 | + origin: '/?gender=2,3&msort=6', | ||
64 | + target: helpers.urlFormat('/?category_id=52&gender=2,3', null, 'list') | ||
65 | + }, | ||
66 | + { | ||
67 | + type: TYPE.redirect, | ||
68 | + origin: '/?gender=2,3&msort=7', | ||
69 | + target: helpers.urlFormat('/?category_id=59&gender=2,3', null, 'list') | ||
70 | + }, | ||
71 | + { | ||
72 | + type: TYPE.redirect, | ||
73 | + origin: '/?gender=2,3&msort=8,10,241', | ||
74 | + target: helpers.urlFormat('/?category_id=76&gender=2,3', null, 'list') | ||
75 | + }, | ||
76 | + // 潮童销售类目一级菜单 | ||
77 | + { | ||
78 | + type: TYPE.redirect, | ||
79 | + origin: '/?gender=1,2,3&misort=382,368,372,448,392,388,384,414,429,390,425,464&msort=365', | ||
80 | + target: helpers.urlFormat('/?category_id=13,16,15&gender=1,2,3', null, 'list') | ||
81 | + }, | ||
82 | + // 创意生活销售类目一级菜单 | ||
83 | + { | ||
84 | + type: TYPE.redirect, | ||
85 | + origin: '/?msort=10&misort=103', | ||
86 | + target: helpers.urlFormat('/?category_id=21', null, 'list') | ||
87 | + }, | ||
88 | + { | ||
89 | + type: TYPE.redirect, | ||
90 | + origin: '/?msort=10&misort=266', | ||
91 | + target: helpers.urlFormat('/?category_id=20', null, 'list') | ||
92 | + }, | ||
93 | + { | ||
94 | + type: TYPE.redirect, | ||
95 | + origin: '/?msort=10&misort=101,280', | ||
96 | + target: helpers.urlFormat('/?category_id=251', null, 'list') | ||
97 | + }, | ||
98 | + { | ||
99 | + type: TYPE.redirect, | ||
100 | + origin: '/?misort=259&msort=10', | ||
101 | + target: helpers.urlFormat('/?category_id=23', null, 'list') | ||
102 | + }, | ||
34 | 103 | ||
35 | // 筛选参数排序匹配 | 104 | // 筛选参数排序匹配 |
36 | { | 105 | { |
-
Please register or login to post a comment