diff --git a/app/not-found.tsx b/app/not-found.tsx index 7ae36f3..15250ea 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -1,7 +1,30 @@ +import Notfound from "../public/not-found.svg"; +import Image from "next/image"; +import Link from "next/link"; + export default function NotFound() { return ( -
-

404 | Page Not Found

+
+
+ Not Found +
+ 404 +
+

+ OOps! +
Page Not Found +

+

+ Sorry about that! Please visit our homepage to get where you need to + go. +

+ + + +
); } diff --git a/app/robots.txt/route.ts b/app/robots.txt/route.ts new file mode 100644 index 0000000..ae87053 --- /dev/null +++ b/app/robots.txt/route.ts @@ -0,0 +1,12 @@ +import { NextResponse } from "next/server"; + +export async function GET() { + const robots = `User-agent: *\nAllow: /\nSitemap: ${ + process.env.NEXT_PUBLIC_SITE_URL || "https://nexlayer.com" + }/sitemap.xml`; + return new NextResponse(robots, { + headers: { + "Content-Type": "text/plain", + }, + }); +} diff --git a/app/sitemap.xml/route.ts b/app/sitemap.xml/route.ts new file mode 100644 index 0000000..ba5af14 --- /dev/null +++ b/app/sitemap.xml/route.ts @@ -0,0 +1,45 @@ +import { NextResponse } from "next/server"; +import fs from "fs"; +import path from "path"; + +function getAppRoutes(appDir: string): string[] { + const urls: string[] = []; + function walk(dir: string, base: string = "") { + const files = fs.readdirSync(dir); + for (const file of files) { + const fullPath = path.join(dir, file); + const stat = fs.statSync(fullPath); + if (stat.isDirectory()) { + walk(fullPath, path.join(base, file)); + } else if (file === "page.tsx") { + let route = path.join(base, "/").replace(/\\/g, "/"); + route = route.replace(/\/page$/, ""); + if (!route.startsWith("/")) { + route = "/" + route; + } + urls.push(route); + } + } + } + walk(appDir); + return urls.filter((u, i, arr) => arr.indexOf(u) === i); +} + +export async function GET() { + const appDir = path.join(process.cwd(), "app"); + const urls = getAppRoutes(appDir); + const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://nexlayer.com"; + const allUrls = Array.from(new Set([...urls, "/playground"])); + const sitemap = `\n\n${allUrls + .map( + (url) => + ` ${baseUrl}${url}monthly1.0` + ) + .join("\n")}\n`; + + return new NextResponse(sitemap, { + headers: { + "Content-Type": "application/xml", + }, + }); +} diff --git a/components/layout/Footer.tsx b/components/layout/Footer.tsx index 9426431..b624ad0 100644 --- a/components/layout/Footer.tsx +++ b/components/layout/Footer.tsx @@ -7,7 +7,6 @@ export const Footer = () => {