Authored by 郭成尧

seo-intro

@@ -325,7 +325,6 @@ const listNew = (req, res, next) => { @@ -325,7 +325,6 @@ const listNew = (req, res, next) => {
325 } 325 }
326 co(function* () { 326 co(function* () {
327 let result = yield req.ctx(searchModel).getCategoryGoods(initialData); 327 let result = yield req.ctx(searchModel).getCategoryGoods(initialData);
328 - let categoryIntro = '';  
329 328
330 let responseResult = { 329 let responseResult = {
331 list: productProcess.processProductList(result.data.product_list || [], { 330 list: productProcess.processProductList(result.data.product_list || [], {
@@ -345,7 +344,12 @@ const listNew = (req, res, next) => { @@ -345,7 +344,12 @@ const listNew = (req, res, next) => {
345 seoTitle = decodeURIComponent(params.sort_name); 344 seoTitle = decodeURIComponent(params.sort_name);
346 } 345 }
347 346
348 - categoryIntro = yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description'); 347 + let categoryIntroRedis =
  348 + yield redis.hmgetAsync(`category:description:${md5(seoTitle)}`, 'category', 'description');
  349 + let categoryIntro = categoryIntroRedis[1] ? {
  350 + title: categoryIntroRedis[0],
  351 + desc: categoryIntroRedis[1]
  352 + } : null;
349 353
350 res.render('search/goods-list', Object.assign({ 354 res.render('search/goods-list', Object.assign({
351 _noLazy: true, // 首屏不使用lazyload 355 _noLazy: true, // 首屏不使用lazyload
@@ -4,3 +4,8 @@ @@ -4,3 +4,8 @@
4 <input type="text" id="category-point" style="display:none" value="{{category}}"> 4 <input type="text" id="category-point" style="display:none" value="{{category}}">
5 {{/if}} 5 {{/if}}
6 </div> 6 </div>
  7 +{{#categoryIntro}}
  8 +<div class="seo-data">
  9 + <h1>{{title}}</h1>{{desc}}
  10 +</div>
  11 +{{/categoryIntro}}
@@ -600,3 +600,12 @@ @@ -600,3 +600,12 @@
600 margin-bottom: 100px; 600 margin-bottom: 100px;
601 } 601 }
602 } 602 }
  603 +
  604 +.seo-data {
  605 + > h1 {
  606 + display: inline;
  607 + }
  608 +
  609 + color: #b0b0b0;
  610 + padding: 30px;
  611 +}