Authored by htoooth

Merge branch 'feature/seoUrl' into release/5.4.1

@@ -151,13 +151,13 @@ const logger = global.yoho.logger; @@ -151,13 +151,13 @@ const logger = global.yoho.logger;
151 151
152 // dispatcher 152 // dispatcher
153 try { 153 try {
  154 + const setYohoData = require('./doraemon/middleware/set-yoho-data');
154 const htaccess = require('./doraemon/middleware/htaccess'); 155 const htaccess = require('./doraemon/middleware/htaccess');
155 const subDomain = require('./doraemon/middleware/sub-domain'); 156 const subDomain = require('./doraemon/middleware/sub-domain');
156 const mobileRefer = require('./doraemon/middleware/mobile-refer'); 157 const mobileRefer = require('./doraemon/middleware/mobile-refer');
157 const mobileCheck = require('./doraemon/middleware/mobile-check'); 158 const mobileCheck = require('./doraemon/middleware/mobile-check');
158 const user = require('./doraemon/middleware/user'); 159 const user = require('./doraemon/middleware/user');
159 const seo = require('./doraemon/middleware/seo'); 160 const seo = require('./doraemon/middleware/seo');
160 - const setYohoData = require('./doraemon/middleware/set-yoho-data');  
161 const errorHanlder = require('./doraemon/middleware/error-handler'); 161 const errorHanlder = require('./doraemon/middleware/error-handler');
162 const setPageInfo = require('./doraemon/middleware/set-pageinfo'); 162 const setPageInfo = require('./doraemon/middleware/set-pageinfo');
163 const layoutTools = require('./doraemon/middleware/layout-tools'); 163 const layoutTools = require('./doraemon/middleware/layout-tools');
@@ -165,11 +165,11 @@ try { @@ -165,11 +165,11 @@ try {
165 const devtool = require('./doraemon/middleware/devtools'); 165 const devtool = require('./doraemon/middleware/devtools');
166 166
167 // YOHO 前置中间件 167 // YOHO 前置中间件
  168 + app.use(setYohoData());
168 app.use(htaccess()); 169 app.use(htaccess());
169 app.use(subDomain()); 170 app.use(subDomain());
170 app.use(mobileRefer()); 171 app.use(mobileRefer());
171 app.use(mobileCheck()); 172 app.use(mobileCheck());
172 - app.use(setYohoData());  
173 app.use(user()); 173 app.use(user());
174 app.use(seo()); 174 app.use(seo());
175 app.use(setPageInfo()); 175 app.use(setPageInfo());
@@ -54,6 +54,25 @@ module.exports = [ @@ -54,6 +54,25 @@ module.exports = [
54 } 54 }
55 }, 55 },
56 56
  57 + // 老的编缉首页
  58 + {
  59 + type: TYPE.redirect,
  60 + origin: (req) => {
  61 + return /index\/editor/i.test(req.path);
  62 + },
  63 + target: (req) => {
  64 + let channel = req.yoho.channel;
  65 + let aid = req.query.author_id;
  66 +
  67 + if (!aid) {
  68 + return helpers.urlFormat(`/${channel}/`, null, 'guang');
  69 + }
  70 +
  71 + req.mobileUrl = `${MOBILE_DOMAIN}/author/${aid}/`;
  72 + return helpers.urlFormat(`/${channel}-author-i${aid}/`, null, 'guang');
  73 + }
  74 + },
  75 +
57 // 编缉首页 76 // 编缉首页
58 { 77 {
59 type: TYPE.rewrite, 78 type: TYPE.rewrite,