From 9066f4804489a3aca6a0a556b2c507446bfca89b Mon Sep 17 00:00:00 2001 From: ridhozhr10 Date: Sat, 1 Jun 2024 08:19:31 +0700 Subject: [PATCH] feat: add robot.txt and sitemap --- src/app/robots.ts | 13 +++++++++++++ src/app/sitemap.ts | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/app/robots.ts create mode 100644 src/app/sitemap.ts diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 0000000..8b24f40 --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,13 @@ +import { baseURL } from "@/constants"; +import { MetadataRoute } from "next"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/", + disallow: "/private/", + }, + sitemap: `${baseURL}/sitemap.xml`, + }; +} diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..94e1252 --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,19 @@ +import { baseURL } from "@/constants"; +import { MetadataRoute } from "next"; + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + { + url: baseURL, + }, + { + url: `${baseURL}/about`, + }, + { + url: `${baseURL}/cv`, + }, + { + url: `${baseURL}/posts`, + }, + ]; +}