feat: redirection

This commit is contained in:
DIYgod 2023-08-01 11:14:45 +01:00
parent 45760405be
commit e748e2a648
No known key found for this signature in database
3 changed files with 30 additions and 2 deletions

View File

@ -128,6 +128,31 @@ module.exports = withSentryConfig(
]
},
staticPageGenerationTimeout: 3600,
async redirects() {
return [
{
source: "/sitemap.txt",
destination: "/sitemap.xml",
permanent: true,
},
{
source: "/sitemap.xml.gz",
destination: "/sitemap.xml",
permanent: true,
},
{
source: "/sitemap_index.xml",
destination: "/sitemap.xml",
permanent: true,
},
{
source: "/sitemaps.xml",
destination: "/sitemap.xml",
permanent: true,
},
]
},
}),
),
{

View File

@ -37,6 +37,7 @@ export const GET = async (req: NextRequest) => {
type: "post",
visibility: PageVisibilityEnum.Published,
limit: 1000,
skipExpansion: true,
},
queryClient,
)

View File

@ -44,7 +44,7 @@ export default async function middleware(req: NextRequest) {
return NextResponse.redirect(`https://${req.headers.get("host")}/feed`, 301)
}
console.debug(`${req.method} ${req.nextUrl.pathname}${req.nextUrl.search}`)
console.debug(`${req.method} ${req.nextUrl}`)
if (
pathname.startsWith("/api/") ||
@ -54,7 +54,9 @@ export default async function middleware(req: NextRequest) {
pathname.startsWith("/locales/") ||
pathname.match(/^\/(workbox|worker|fallback)-\w+\.js(\.map)?$/) ||
pathname === "/sw.js" ||
pathname === "/sw.js.map"
pathname === "/sw.js.map" ||
pathname === "/monitoring" ||
pathname === "favicon.ico"
) {
return NextResponse.next()
}