Authored by 毕凯

Merge branch 'feature/seo2' into 'gray'

Feature/seo2



See merge request !1100
... ... @@ -326,7 +326,6 @@ const listNew = (req, res, next) => {
}
co(function* () {
let result = yield req.ctx(searchModel).getCategoryGoods(initialData);
let categoryIntro = '';
let responseResult = {
list: productProcess.processProductList(result.data.product_list || [], {
... ... @@ -346,7 +345,12 @@ const listNew = (req, res, next) => {
seoTitle = decodeURIComponent(params.sort_name);
}
categoryIntro = yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description');
let categoryIntroRedis =
yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description');
let categoryIntro = categoryIntroRedis[1] ? {
title: categoryIntroRedis[0],
desc: categoryIntroRedis[1]
} : null;
res.render('search/goods-list', Object.assign({
_noLazy: true, // 首屏不使用lazyload
... ...
... ... @@ -4,3 +4,8 @@
<input type="text" id="category-point" style="display:none" value="{{category}}">
{{/if}}
</div>
{{#categoryIntro}}
<div class="seo-data">
<h1>{{title}}</h1>{{desc}}
</div>
{{/categoryIntro}}
... ...
... ... @@ -600,3 +600,12 @@
margin-bottom: 100px;
}
}
.seo-data {
> h1 {
display: inline;
}
color: #b0b0b0;
padding: 30px;
}
... ...
... ... @@ -41,7 +41,10 @@ const getParams = (url) => {
_.forEach(paramsRaw, paramRaw => {
let keyRaw = paramRaw.substr(0, 2);
let valueRaw = _.replace(paramRaw, keyRaw, '');
let valueRaw = _.chain(paramRaw)
.replace(keyRaw, '')
.replace('__', '-')
.value();
if (PARAMMAP[keyRaw]) {
params[PARAMMAP[keyRaw]] = valueRaw;
... ...
... ... @@ -102,15 +102,15 @@ const getSearchParamsWithoutMethod = (params) => {
finalParams.yh_channel = params.yh_channel;
}
if (params.brand) {
if (params.brand && params.brand !== '0') {
finalParams.brand = params.brand;
}
if (params.brand_id) {
if (params.brand_id && params.brand_id !== '0') {
finalParams.brand = params.brand_id;
}
if (params.shop_id) {
if (params.shop_id && params.shop_id !== '0') {
finalParams.shop_id = params.shop_id;
}
... ... @@ -158,7 +158,7 @@ const getSearchParamsWithoutMethod = (params) => {
finalParams.type = params.type;
}
if (params.category_id) {
if (params.category_id && params.category_id !== '0') {
finalParams.category_id = params.category_id;
}
... ...