Authored by yyq

Merge branch 'feature/seo1204' into release/6.3

... ... @@ -28,7 +28,7 @@
<div class="footer">
<div class="tags">
{{# tags}}
<a class="msg-tag" href="{{url}}" target="_blank" rel="nofollow">{{tag}}</a>
<a class="msg-tag" href="{{url}}" target="_blank">{{tag}}</a>
{{/ tags}}
</div>
<div class="like-comment">
... ...
... ... @@ -79,6 +79,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => {
break;
default: // eslint-disable-line
let navList = [];
const cateUrl = handleFilterUrl(baseUrl, {category_id: '{categoryId}'});
_.forEach(data, sort => {
let sortName = sort.category_name,
... ... @@ -87,6 +88,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => {
if (`${params.category_id}` === sortCategoryId) {
navList = [{
name: sortName,
href: cateUrl.replace('{categoryId}', sortCategoryId),
pathTitle: sortName
}];
return false;
... ... @@ -97,10 +99,11 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => {
if (`${params.category_id}` === `${misort.category_id}`) {
navList = [{
name: sortName,
href: handleFilterUrl(baseUrl, {category_id: sortCategoryId}),
href: cateUrl.replace('{categoryId}', sortCategoryId),
pathTitle: sortName
}, {
name: misortName,
href: cateUrl.replace('{categoryId}', misort.category_id),
pathTitle: misortName
}];
return false;
... ...
... ... @@ -152,10 +152,37 @@ function getListData(params, channel) {
// 通过pathNav获取选中品类
let pathNav = _.get(finalResult, 'list.pathNav', []);
let checkedBrand = _.find(_.get(finalResult, 'list.filters.checkedConditions.conditions', []),
['itemType', 'brand']);
let shopUrl = _.get(finalResult, 'list.goods[0].brandUrl');
let sortName;
if (pathNav.length > 1) {
let sortName = _.last(pathNav).name;
sortName = _.last(pathNav).name;
}
// 当选中品类且只选中一个品牌时导航栏展示品牌信息 for seo
if (shopUrl && !_.isEmpty(checkedBrand) && _.indexOf(checkedBrand.totalName, ',') === -1) {
pathNav.push({
href: shopUrl,
name: checkedBrand.totalName,
pathTitle: checkedBrand.totalName
});
if (sortName) {
pathNav.push({
href: `${shopUrl}?category_id=${params.category_id}`,
name: `${checkedBrand.totalName}${sortName}`,
pathTitle: `${checkedBrand.totalName}${sortName}`
});
}
_.last(pathNav).last = true;
pathNav.push({});
}
if (sortName) {
return redis.all([
['hmget', `category:description:${md5(sortName)}`, 'description']
]).then(desc => {
... ...
... ... @@ -5,7 +5,8 @@
'use strict';
// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const helpers = global.yoho.helpers;
const handleStaticUrl = require(`${global.utils}/parameter`).fullParamToMinPath;
// const mapSort = require(`${global.utils}/map-sort`);
const TYPE = require('../type');
... ... @@ -131,11 +132,11 @@ module.exports = [
// target: req => helpers.urlFormat(req.path, mapSort(req.query), 'list')
// },
{
type: TYPE.rewrite,
type: TYPE.redirect,
origin: req => {
return !req.path || req.path === '/';
},
target: '/product/list/index'
target: req => helpers.urlFormat(handleStaticUrl('/list', req.query))
},
{
type: TYPE.rewrite,
... ...
... ... @@ -15,9 +15,11 @@
<span {{#if @last}}class="last"{{/if}} title="{{pathTitle}}">{{{name}}}</span>
{{/if}}
{{#unless last}}
{{#unless @last}}
<span class="iconfont">&#xe60c;</span>
{{/unless}}
{{/unless}}
{{/if}}
{{/each}}
</p>
... ...
... ... @@ -17,7 +17,7 @@
</a>
{{/each}}
<a class="clear-checked" href="{{clearUrl}}">清空筛选条件</a>
<a class="clear-checked" href="{{clearUrl}}" rel="nofollow">清空筛选条件</a>
</div>
</div>
{{/if}}
... ...