forked from dubinc/dub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobots.ts
More file actions
28 lines (25 loc) · 806 Bytes
/
robots.ts
File metadata and controls
28 lines (25 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { SHORT_DOMAIN } from "@dub/utils";
import { MetadataRoute } from "next";
import { headers } from "next/headers";
export default function robots(): MetadataRoute.Robots {
const headersList = headers();
let domain = headersList.get("host") as string;
if (domain === "dub.localhost:8888" || domain.endsWith(".vercel.app")) {
// for local development and preview URLs
domain = SHORT_DOMAIN;
}
return {
rules: [
{
userAgent: "Googlebot", // for Googlebot
allow: ["/$", "/api/og/"], // allow the home page and the OG image API
disallow: "/", // disallow everything else
},
{
userAgent: "LinkedInBot", // for LinkedInBot
allow: "/", // allow everything
},
],
sitemap: `https://${domain}/sitemap.xml`,
};
}