|
@@ -1,16 +1,21 @@
|
|
|
import { NextResponse } from 'next/server'
|
|
import { NextResponse } from 'next/server'
|
|
|
|
|
|
|
|
const redirectRules = {
|
|
const redirectRules = {
|
|
|
- "/umi": {
|
|
|
|
|
- "/web3js-adapters": "/umi/web3js-differences-and-adapters",
|
|
|
|
|
- "/web3js-differences": "/umi/web3js-differences-and-adapters",
|
|
|
|
|
- "/connecting-to-umi": "/umi/getting-started",
|
|
|
|
|
|
|
+ '/umi': {
|
|
|
|
|
+ '/web3js-adapters': '/umi/web3js-differences-and-adapters',
|
|
|
|
|
+ '/web3js-differences': '/umi/web3js-differences-and-adapters',
|
|
|
|
|
+ '/connecting-to-umi': '/umi/getting-started',
|
|
|
},
|
|
},
|
|
|
- "/toolbox": {
|
|
|
|
|
- "/": "/umi/toolbox",
|
|
|
|
|
- "/getting-started": "/umi/toolbox",
|
|
|
|
|
|
|
+ '/toolbox': {
|
|
|
|
|
+ '/': '/umi/toolbox',
|
|
|
|
|
+ '/getting-started': '/umi/toolbox',
|
|
|
},
|
|
},
|
|
|
- "/core/guides/javascript/how-to-create-a-core-nft-asset": "/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript",
|
|
|
|
|
|
|
+ '/guides': {
|
|
|
|
|
+ '/javascript/how-to-create-an-spl-token-on-solana':
|
|
|
|
|
+ '/guides/javascript/how-to-create-a-solana-token',
|
|
|
|
|
+ },
|
|
|
|
|
+ '/core/guides/javascript/how-to-create-a-core-nft-asset':
|
|
|
|
|
+ '/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript',
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function middleware(request) {
|
|
export function middleware(request) {
|
|
@@ -23,7 +28,7 @@ export function middleware(request) {
|
|
|
return NextResponse.redirect(new URL(rule, request.url), 308)
|
|
return NextResponse.redirect(new URL(rule, request.url), 308)
|
|
|
} else if (typeof rule === 'object') {
|
|
} else if (typeof rule === 'object') {
|
|
|
// Nested redirects
|
|
// Nested redirects
|
|
|
- const subPath = pathname.slice(rootPath.length) || "/"
|
|
|
|
|
|
|
+ const subPath = pathname.slice(rootPath.length) || '/'
|
|
|
const destination = rule[subPath]
|
|
const destination = rule[subPath]
|
|
|
if (destination) {
|
|
if (destination) {
|
|
|
return NextResponse.redirect(new URL(destination, request.url), 308)
|
|
return NextResponse.redirect(new URL(destination, request.url), 308)
|
|
@@ -40,5 +45,6 @@ export const config = {
|
|
|
'/umi/:path*',
|
|
'/umi/:path*',
|
|
|
'/toolbox/:path*',
|
|
'/toolbox/:path*',
|
|
|
'/core/guides/javascript/how-to-create-a-core-nft-asset',
|
|
'/core/guides/javascript/how-to-create-a-core-nft-asset',
|
|
|
|
|
+ '/guides/javascript/how-to-create-an-spl-token-on-solana',
|
|
|
],
|
|
],
|
|
|
}
|
|
}
|