Skip to content

The Open Standard for Generative UI

Add missing sitemap and robots.txt (#283)

Rabi Shanker Guha3dca4400ba85
diff --git a/README.md b/README.md
index 427aaa84b..3bd2c2507 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# OpenUI
-[Docs](https://openui.com) · [Example App](./examples/openui-chat) · [Contributing](./CONTRIBUTING.md) · [License](./LICENSE)
+[Docs](https://www.openui.com) · [Example App](./examples/openui-chat) · [Contributing](./CONTRIBUTING.md) · [License](./LICENSE)
Build **LLM-powered user interfaces** with OpenUI Lang, streaming rendering, and generative UI.
diff --git a/docs/app/api/playground/stream/route.ts b/docs/app/api/playground/stream/route.ts
index 661e66cab..633cc3622 100644
--- a/docs/app/api/playground/stream/route.ts
+++ b/docs/app/api/playground/stream/route.ts
@@ -1,4 +1,5 @@
import { type NextRequest } from "next/server";
+import { BASE_URL } from "@/lib/source";
export async function POST(req: NextRequest) {
const { model, prompt, systemPrompt } = await req.json();
@@ -8,7 +9,7 @@ export async function POST(req: NextRequest) {
headers: {
Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
"Content-Type": "application/json",
- "HTTP-Referer": "https://openui.com/playground",
+ "HTTP-Referer": `${BASE_URL}/playground`,
"X-Title": "OpenUI Playground",
},
body: JSON.stringify({
diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx
index daa281c3b..e37795068 100644
--- a/docs/app/layout.tsx
+++ b/docs/app/layout.tsx
@@ -4,16 +4,19 @@ import { Inter } from "next/font/google";
import Script from "next/script";
import "./global.css";
import { PHProvider } from "./providers";
+import { BASE_URL } from "../lib/source";
const inter = Inter({
subsets: ["latin"],
});
export const metadata: Metadata = {
+ metadataBase: new URL(BASE_URL),
title: {
default: "OpenUI",
template: "%s | OpenUI",
},
+ description: "The Open Standard for Generative UI",
icons: {
icon: "/favicon.svg",
shortcut: "/favicon.svg",
diff --git a/docs/app/robots.ts b/docs/app/robots.ts
new file mode 100644
index 000000000..f112dfa7a
--- /dev/null
+++ b/docs/app/robots.ts
@@ -0,0 +1,12 @@
+import { BASE_URL } from "@/lib/source";
+import type { MetadataRoute } from "next";
+
+export default function robots(): MetadataRoute.Robots {
+ return {
+ rules: {
+ userAgent: "*",
+ allow: "/",
+ },
+ sitemap: `${BASE_URL}/sitemap.xml`,
+ };
+}
diff --git a/docs/app/sitemap.ts b/docs/app/sitemap.ts
new file mode 100644
index 000000000..f27018ae8
--- /dev/null
+++ b/docs/app/sitemap.ts
@@ -0,0 +1,19 @@
+import { BASE_URL, source } from "@/lib/source";
+
+const STATIC_PATHS = ["/", "/playground"];
+
+export default async function sitemap() {
+ const staticRoutes = STATIC_PATHS.map((path) => ({
+ url: `${BASE_URL}${path}`,
+ lastModified: new Date(),
+ changeFrequency: "weekly" as const,
+ }));
+
+ const docsRoutes = source.getPages().map((page) => ({
+ url: `${BASE_URL}${page.url}`,
+ lastModified: page.data.lastModified,
+ changeFrequency: "weekly" as const,
+ }));
+
+ return [...staticRoutes, ...docsRoutes];
+}
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index 2b57bf161..f96c83c2d 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -2,6 +2,8 @@ import { type InferPageType, loader } from "fumadocs-core/source";
import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
import { docs } from "fumadocs-mdx:collections/server";
+export const BASE_URL = "https://www.openui.com";
+
// See https://fumadocs.dev/docs/headless/source-api for more info
export const source = loader({
baseUrl: "/docs",
diff --git a/docs/source.config.ts b/docs/source.config.ts
index 773f29b48..c026ff074 100644
--- a/docs/source.config.ts
+++ b/docs/source.config.ts
@@ -1,5 +1,6 @@
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
+import lastModified from "fumadocs-mdx/plugins/last-modified";
// You can customise Zod schemas for frontmatter and `meta.json` here
// see https://fumadocs.dev/docs/mdx/collections
@@ -17,7 +18,5 @@ export const docs = defineDocs({
});
export default defineConfig({
- mdxOptions: {
- // MDX options
- },
+ plugins: [lastModified()],
});