Generates a standard robots.txt file for search engine crawlers. Use this in Next.js projects to define indexing rules and link to the site sitemap.
// Source: https://github.com/MkThingsHQ/mkdirs | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { siteConfig } from "@/config/site";
import type { MetadataRoute } from "next";
/**
* https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots
*/
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
},
sitemap: `${siteConfig.url}/sitemap.xml`,
};
}
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key