Merge branch 'feature/seo1204' into release/6.3
Showing
6 changed files
with
40 additions
and
7 deletions
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | <div class="footer"> | 28 | <div class="footer"> |
29 | <div class="tags"> | 29 | <div class="tags"> |
30 | {{# tags}} | 30 | {{# tags}} |
31 | - <a class="msg-tag" href="{{url}}" target="_blank" rel="nofollow">{{tag}}</a> | 31 | + <a class="msg-tag" href="{{url}}" target="_blank">{{tag}}</a> |
32 | {{/ tags}} | 32 | {{/ tags}} |
33 | </div> | 33 | </div> |
34 | <div class="like-comment"> | 34 | <div class="like-comment"> |
@@ -79,6 +79,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | @@ -79,6 +79,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | ||
79 | break; | 79 | break; |
80 | default: // eslint-disable-line | 80 | default: // eslint-disable-line |
81 | let navList = []; | 81 | let navList = []; |
82 | + const cateUrl = handleFilterUrl(baseUrl, {category_id: '{categoryId}'}); | ||
82 | 83 | ||
83 | _.forEach(data, sort => { | 84 | _.forEach(data, sort => { |
84 | let sortName = sort.category_name, | 85 | let sortName = sort.category_name, |
@@ -87,6 +88,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | @@ -87,6 +88,7 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | ||
87 | if (`${params.category_id}` === sortCategoryId) { | 88 | if (`${params.category_id}` === sortCategoryId) { |
88 | navList = [{ | 89 | navList = [{ |
89 | name: sortName, | 90 | name: sortName, |
91 | + href: cateUrl.replace('{categoryId}', sortCategoryId), | ||
90 | pathTitle: sortName | 92 | pathTitle: sortName |
91 | }]; | 93 | }]; |
92 | return false; | 94 | return false; |
@@ -97,10 +99,11 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | @@ -97,10 +99,11 @@ const handlePathNavData = (data, params, page, channel, baseUrl) => { | ||
97 | if (`${params.category_id}` === `${misort.category_id}`) { | 99 | if (`${params.category_id}` === `${misort.category_id}`) { |
98 | navList = [{ | 100 | navList = [{ |
99 | name: sortName, | 101 | name: sortName, |
100 | - href: handleFilterUrl(baseUrl, {category_id: sortCategoryId}), | 102 | + href: cateUrl.replace('{categoryId}', sortCategoryId), |
101 | pathTitle: sortName | 103 | pathTitle: sortName |
102 | }, { | 104 | }, { |
103 | name: misortName, | 105 | name: misortName, |
106 | + href: cateUrl.replace('{categoryId}', misort.category_id), | ||
104 | pathTitle: misortName | 107 | pathTitle: misortName |
105 | }]; | 108 | }]; |
106 | return false; | 109 | return false; |
@@ -152,10 +152,37 @@ function getListData(params, channel) { | @@ -152,10 +152,37 @@ function getListData(params, channel) { | ||
152 | 152 | ||
153 | // 通过pathNav获取选中品类 | 153 | // 通过pathNav获取选中品类 |
154 | let pathNav = _.get(finalResult, 'list.pathNav', []); | 154 | let pathNav = _.get(finalResult, 'list.pathNav', []); |
155 | + let checkedBrand = _.find(_.get(finalResult, 'list.filters.checkedConditions.conditions', []), | ||
156 | + ['itemType', 'brand']); | ||
157 | + let shopUrl = _.get(finalResult, 'list.goods[0].brandUrl'); | ||
158 | + let sortName; | ||
155 | 159 | ||
156 | if (pathNav.length > 1) { | 160 | if (pathNav.length > 1) { |
157 | - let sortName = _.last(pathNav).name; | 161 | + sortName = _.last(pathNav).name; |
162 | + } | ||
163 | + | ||
164 | + // 当选中品类且只选中一个品牌时导航栏展示品牌信息 for seo | ||
165 | + if (shopUrl && !_.isEmpty(checkedBrand) && _.indexOf(checkedBrand.totalName, ',') === -1) { | ||
166 | + pathNav.push({ | ||
167 | + href: shopUrl, | ||
168 | + name: checkedBrand.totalName, | ||
169 | + pathTitle: checkedBrand.totalName | ||
170 | + }); | ||
171 | + | ||
172 | + if (sortName) { | ||
173 | + pathNav.push({ | ||
174 | + href: `${shopUrl}?category_id=${params.category_id}`, | ||
175 | + name: `${checkedBrand.totalName}${sortName}`, | ||
176 | + pathTitle: `${checkedBrand.totalName}${sortName}` | ||
177 | + }); | ||
178 | + } | ||
179 | + | ||
180 | + _.last(pathNav).last = true; | ||
181 | + | ||
182 | + pathNav.push({}); | ||
183 | + } | ||
158 | 184 | ||
185 | + if (sortName) { | ||
159 | return redis.all([ | 186 | return redis.all([ |
160 | ['hmget', `category:description:${md5(sortName)}`, 'description'] | 187 | ['hmget', `category:description:${md5(sortName)}`, 'description'] |
161 | ]).then(desc => { | 188 | ]).then(desc => { |
@@ -5,7 +5,8 @@ | @@ -5,7 +5,8 @@ | ||
5 | 'use strict'; | 5 | 'use strict'; |
6 | 6 | ||
7 | // const _ = require('lodash'); | 7 | // const _ = require('lodash'); |
8 | -// const helpers = global.yoho.helpers; | 8 | +const helpers = global.yoho.helpers; |
9 | +const handleStaticUrl = require(`${global.utils}/parameter`).fullParamToMinPath; | ||
9 | 10 | ||
10 | // const mapSort = require(`${global.utils}/map-sort`); | 11 | // const mapSort = require(`${global.utils}/map-sort`); |
11 | const TYPE = require('../type'); | 12 | const TYPE = require('../type'); |
@@ -131,11 +132,11 @@ module.exports = [ | @@ -131,11 +132,11 @@ module.exports = [ | ||
131 | // target: req => helpers.urlFormat(req.path, mapSort(req.query), 'list') | 132 | // target: req => helpers.urlFormat(req.path, mapSort(req.query), 'list') |
132 | // }, | 133 | // }, |
133 | { | 134 | { |
134 | - type: TYPE.rewrite, | 135 | + type: TYPE.redirect, |
135 | origin: req => { | 136 | origin: req => { |
136 | return !req.path || req.path === '/'; | 137 | return !req.path || req.path === '/'; |
137 | }, | 138 | }, |
138 | - target: '/product/list/index' | 139 | + target: req => helpers.urlFormat(handleStaticUrl('/list', req.query)) |
139 | }, | 140 | }, |
140 | { | 141 | { |
141 | type: TYPE.rewrite, | 142 | type: TYPE.rewrite, |
@@ -15,9 +15,11 @@ | @@ -15,9 +15,11 @@ | ||
15 | <span {{#if @last}}class="last"{{/if}} title="{{pathTitle}}">{{{name}}}</span> | 15 | <span {{#if @last}}class="last"{{/if}} title="{{pathTitle}}">{{{name}}}</span> |
16 | {{/if}} | 16 | {{/if}} |
17 | 17 | ||
18 | + {{#unless last}} | ||
18 | {{#unless @last}} | 19 | {{#unless @last}} |
19 | <span class="iconfont"></span> | 20 | <span class="iconfont"></span> |
20 | {{/unless}} | 21 | {{/unless}} |
22 | + {{/unless}} | ||
21 | {{/if}} | 23 | {{/if}} |
22 | {{/each}} | 24 | {{/each}} |
23 | </p> | 25 | </p> |
-
Please register or login to post a comment