feat: robots.txt
This commit is contained in:
parent
abe56af40f
commit
6488cd867d
|
|
@ -5,7 +5,7 @@ export default function robots(): MetadataRoute.Robots {
|
|||
rules: {
|
||||
userAgent: "*",
|
||||
allow: "/",
|
||||
disallow: ["/dashboard/", "/preview/", "/api/"],
|
||||
disallow: ["/dashboard/", "/preview/"],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
import { NextRequest } from "next/server"
|
||||
|
||||
import { NextServerResponse } from "~/lib/server-helper"
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
const response = new NextServerResponse()
|
||||
|
||||
return response.headers({
|
||||
"Content-Type": "text/plain",
|
||||
"Access-Control-Allow-Methods": "GET",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
}).text(`User-Agent: *
|
||||
Allow: /
|
||||
Disallow: /dashboard/
|
||||
Disallow: /preview/
|
||||
Disallow: /api/
|
||||
|
||||
Sitemap: https://${req.headers.get("host")}/sitemap.xml`)
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ export const GET = async (req: NextRequest) => {
|
|||
characterId: site?.characterId,
|
||||
type: "post",
|
||||
visibility: PageVisibilityEnum.Published,
|
||||
limit: 1000,
|
||||
},
|
||||
queryClient,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ 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 === "/robots.txt"
|
||||
pathname === "/sw.js.map"
|
||||
) {
|
||||
return NextResponse.next()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue