Authored by htoooth

Merge branch 'feature/seoUrl' into release/5.4.1

... ... @@ -151,13 +151,13 @@ const logger = global.yoho.logger;
// dispatcher
try {
const setYohoData = require('./doraemon/middleware/set-yoho-data');
const htaccess = require('./doraemon/middleware/htaccess');
const subDomain = require('./doraemon/middleware/sub-domain');
const mobileRefer = require('./doraemon/middleware/mobile-refer');
const mobileCheck = require('./doraemon/middleware/mobile-check');
const user = require('./doraemon/middleware/user');
const seo = require('./doraemon/middleware/seo');
const setYohoData = require('./doraemon/middleware/set-yoho-data');
const errorHanlder = require('./doraemon/middleware/error-handler');
const setPageInfo = require('./doraemon/middleware/set-pageinfo');
const layoutTools = require('./doraemon/middleware/layout-tools');
... ... @@ -165,11 +165,11 @@ try {
const devtool = require('./doraemon/middleware/devtools');
// YOHO 前置中间件
app.use(setYohoData());
app.use(htaccess());
app.use(subDomain());
app.use(mobileRefer());
app.use(mobileCheck());
app.use(setYohoData());
app.use(user());
app.use(seo());
app.use(setPageInfo());
... ...
... ... @@ -54,6 +54,25 @@ module.exports = [
}
},
// 老的编缉首页
{
type: TYPE.redirect,
origin: (req) => {
return /index\/editor/i.test(req.path);
},
target: (req) => {
let channel = req.yoho.channel;
let aid = req.query.author_id;
if (!aid) {
return helpers.urlFormat(`/${channel}/`, null, 'guang');
}
req.mobileUrl = `${MOBILE_DOMAIN}/author/${aid}/`;
return helpers.urlFormat(`/${channel}-author-i${aid}/`, null, 'guang');
}
},
// 编缉首页
{
type: TYPE.rewrite,
... ...