Authored by Targaryen

list-seo

@@ -14,6 +14,7 @@ const crypto = global.yoho.crypto; @@ -14,6 +14,7 @@ const crypto = global.yoho.crypto;
14 const helpers = global.yoho.helpers; 14 const helpers = global.yoho.helpers;
15 const productProcess = require(`${utils}/product-process`); 15 const productProcess = require(`${utils}/product-process`);
16 const searchModel = require(`${mRoot}/search`); 16 const searchModel = require(`${mRoot}/search`);
  17 +const searchProcess = require(`${utils}/search-process`);
17 18
18 /** 19 /**
19 * 从 useragent 获取 uid 20 * 从 useragent 获取 uid
@@ -236,7 +237,7 @@ const category = (req, res, next) => { @@ -236,7 +237,7 @@ const category = (req, res, next) => {
236 } 237 }
237 238
238 searchModel.getSearchData(initialData).then((firstPageGoods) => { 239 searchModel.getSearchData(initialData).then((firstPageGoods) => {
239 - res.render('search/goods-list', { 240 + res.render('search/goods-list', Object.assign({
240 _noLazy: true, // 首屏不使用lazyload 241 _noLazy: true, // 首屏不使用lazyload
241 module: 'product', 242 module: 'product',
242 page: 'search-list', 243 page: 'search-list',
@@ -252,7 +253,7 @@ const category = (req, res, next) => { @@ -252,7 +253,7 @@ const category = (req, res, next) => {
252 localCss: true, 253 localCss: true,
253 appPath: appPath, 254 appPath: appPath,
254 introText: req.query.intro_text 255 introText: req.query.intro_text
255 - }); 256 + }, searchProcess.getListSeoData(req.query.gender, req.query.title || req.query.sort_name)));
256 }).catch(next); 257 }).catch(next);
257 }; 258 };
258 259
@@ -4,6 +4,12 @@ @@ -4,6 +4,12 @@
4 * @date: 2016/7/29 4 * @date: 2016/7/29
5 */ 5 */
6 6
  7 +const _getGender = {
  8 + '1,3': '男生',
  9 + '2,3': '女生',
  10 + '1,2,3': '',
  11 +};
  12 +
7 /** 13 /**
8 * 根据频道判断出性别 14 * 根据频道判断出性别
9 */ 15 */
@@ -66,8 +72,22 @@ const getTypeCont = (type, order) => { @@ -66,8 +72,22 @@ const getTypeCont = (type, order) => {
66 } 72 }
67 }; 73 };
68 74
  75 +/**
  76 + * 品类列表页 SEO 数据
  77 + * @param {*} gender
  78 + * @param {*} sort_name
  79 + */
  80 +const getListSeoData = (gender, sort_name) => {
  81 + return {
  82 + title: `${sort_name}|新款${sort_name}${_getGender[gender]}|品牌正品|YOHO!BUY有货`,
  83 + keywords: `新款${sort_name},${_getGender[gender]}${sort_name},品牌正品`,
  84 + description: `正品网购!YOHO!BUY有货提供新款${sort_name}${_getGender[gender]}${sort_name}100%品牌正品保证,支持货到付款。`
  85 + };
  86 +};
  87 +
69 module.exports = { 88 module.exports = {
70 getGenderByChannel, 89 getGenderByChannel,
71 getChannelType, 90 getChannelType,
72 - getTypeCont 91 + getTypeCont,
  92 + getListSeoData
73 }; 93 };