Explorar o código

SEO解析问题

xinfeng %!s(int64=5) %!d(string=hai) anos
pai
achega
08ded38b5e
Modificáronse 1 ficheiros con 3 adicións e 5 borrados
  1. 3 5
      plugins/router.js

+ 3 - 5
plugins/router.js

@@ -5,7 +5,6 @@ export default ({ app, context,req, store }) => {
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
-    console.log("222222", app.context.route.path)
     return
   }
   
@@ -14,10 +13,9 @@ export default ({ app, context,req, store }) => {
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
-    
     console.log("app.router.options.routes", app.router.options.routes)
     if (isKaifain) {
-      window.__NUXT__.routePath = '/kaifain' + app.context.route.path
+      window.__NUXT__.routePath = app.context.route.path.replace(/^\/kaifain/, '')
       let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifain')[ 0 ]
       let kaifainDetail = app.router.options.routes.filter(v => v.name === 'kaifain-detail-tid')[ 0 ]
       let kaifainCaseDetail = app.router.options.routes.filter(v => v.name === 'kaifain-case-tid')[ 0 ]
@@ -47,7 +45,7 @@ export default ({ app, context,req, store }) => {
     }
     
     if (isJishuin) {
-      window.__NUXT__.routePath =  '/jishuin' + app.context.route.path
+      window.__NUXT__.routePath = app.context.route.path.replace(/^\/jishuin/, '')
       let jishuinCIndex = app.router.options.routes.filter(v => v.name === "jishuinCollectedC1")[ 0 ]
       let jishuinCType = app.router.options.routes.filter(v => v.name === "jishuinCollectedCID1")[ 0 ]
       let jishuinUIndex = app.router.options.routes.filter(v => v.name === "jishuinUserU1")[ 0 ]
@@ -84,7 +82,7 @@ export default ({ app, context,req, store }) => {
     }
     
     if (isJob) {
-      window.__NUXT__.routePath = '/job' + + app.context.route.path
+      window.__NUXT__.routePath = app.context.route.path.replace(/^\/job/, '')
       let jobIndex = app.router.options.routes.filter(v => v.name === 'JobListSeoIndex')[ 0 ]
       let jobDetail = app.router.options.routes.filter(v => v.name === 'job-detail-id')[ 0 ]
       let jobIndexNow = {