Redirect ! page to normal version
This commit is contained in:
1 parent
2668dacef4
commit
cb4b449c72
2 files changed
+17
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
function redirectFragment() {
|
||||||
|
return async (ctx, next) => {
|
||||||
|
const query = ctx.query
|
||||||
|
|
||||||
|
console.log(query)
|
||||||
|
|
||||||
|
if ('_escaped_fragment_' in query) {
|
||||||
|
ctx.redirect(ctx.path)
|
||||||
|
} else {
|
||||||
|
await next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = redirectFragment
|
||||||
@@ -21,6 +21,7 @@ import handlebars from 'handlebars'
|
|||||||
|
|
||||||
const config = require('./config')
|
const config = require('./config')
|
||||||
const error = require('./middlewares/error')
|
const error = require('./middlewares/error')
|
||||||
|
const redirectFragment = require('./middlewares/redirectFragment')
|
||||||
const home = require('./routes/home')
|
const home = require('./routes/home')
|
||||||
const article = require('./routes/articles')
|
const article = require('./routes/articles')
|
||||||
const albums = require('./routes/albums')
|
const albums = require('./routes/albums')
|
||||||
@@ -86,6 +87,7 @@ export default function (store) {
|
|||||||
|
|
||||||
app.use(error.notFound(config.view404))
|
app.use(error.notFound(config.view404))
|
||||||
app.use(sitemap())
|
app.use(sitemap())
|
||||||
|
app.use(redirectFragment())
|
||||||
|
|
||||||
app.use(home.getHome(5))
|
app.use(home.getHome(5))
|
||||||
app.use(gallery.getGallery())
|
app.use(gallery.getGallery())
|
||||||
|
|||||||
Reference in new issue
Block a user