mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 08:26:35 +00:00
Redirect static files to a prefixed path
This commit is contained in:
@@ -2,7 +2,6 @@ import nextMDX from '@next/mdx'
|
|||||||
import { remarkPlugins } from './mdx/remark.mjs'
|
import { remarkPlugins } from './mdx/remark.mjs'
|
||||||
import { rehypePlugins } from './mdx/rehype.mjs'
|
import { rehypePlugins } from './mdx/rehype.mjs'
|
||||||
import { recmaPlugins } from './mdx/recma.mjs'
|
import { recmaPlugins } from './mdx/recma.mjs'
|
||||||
import rehypeSlug from "rehype-slug";
|
|
||||||
|
|
||||||
const withMDX = nextMDX({
|
const withMDX = nextMDX({
|
||||||
options: {
|
options: {
|
||||||
@@ -14,8 +13,10 @@ const withMDX = nextMDX({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
assetPrefix: '/docs-static',
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
|
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
|
||||||
experimental: {
|
experimental: {
|
||||||
|
|||||||
10
src/middleware.js
Normal file
10
src/middleware.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
|
||||||
|
export function middleware(req) {
|
||||||
|
if (req.nextUrl.href.includes('/docs-static/_next/'))
|
||||||
|
return NextResponse.rewrite(
|
||||||
|
req.nextUrl.href.replace('/docs-static/_next/', '/_next/'),
|
||||||
|
);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user