Skip to content

Commit 3dca440

Browse files
authored
Add missing sitemap and robots.txt (#283)
1 parent cf07120 commit 3dca440

7 files changed

Lines changed: 41 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenUI
22

3-
[Docs](https://openui.com) · [Example App](./examples/openui-chat) · [Contributing](./CONTRIBUTING.md) · [License](./LICENSE)
3+
[Docs](https://www.openui.com) · [Example App](./examples/openui-chat) · [Contributing](./CONTRIBUTING.md) · [License](./LICENSE)
44

55
Build **LLM-powered user interfaces** with OpenUI Lang, streaming rendering, and generative UI.
66

docs/app/api/playground/stream/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { type NextRequest } from "next/server";
2+
import { BASE_URL } from "@/lib/source";
23

34
export async function POST(req: NextRequest) {
45
const { model, prompt, systemPrompt } = await req.json();
@@ -8,7 +9,7 @@ export async function POST(req: NextRequest) {
89
headers: {
910
Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
1011
"Content-Type": "application/json",
11-
"HTTP-Referer": "https://openui.com/playground",
12+
"HTTP-Referer": `${BASE_URL}/playground`,
1213
"X-Title": "OpenUI Playground",
1314
},
1415
body: JSON.stringify({

docs/app/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import { Inter } from "next/font/google";
44
import Script from "next/script";
55
import "./global.css";
66
import { PHProvider } from "./providers";
7+
import { BASE_URL } from "../lib/source";
78

89
const inter = Inter({
910
subsets: ["latin"],
1011
});
1112

1213
export const metadata: Metadata = {
14+
metadataBase: new URL(BASE_URL),
1315
title: {
1416
default: "OpenUI",
1517
template: "%s | OpenUI",
1618
},
19+
description: "The Open Standard for Generative UI",
1720
icons: {
1821
icon: "/favicon.svg",
1922
shortcut: "/favicon.svg",

docs/app/robots.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BASE_URL } from "@/lib/source";
2+
import type { MetadataRoute } from "next";
3+
4+
export default function robots(): MetadataRoute.Robots {
5+
return {
6+
rules: {
7+
userAgent: "*",
8+
allow: "/",
9+
},
10+
sitemap: `${BASE_URL}/sitemap.xml`,
11+
};
12+
}

docs/app/sitemap.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { BASE_URL, source } from "@/lib/source";
2+
3+
const STATIC_PATHS = ["/", "/playground"];
4+
5+
export default async function sitemap() {
6+
const staticRoutes = STATIC_PATHS.map((path) => ({
7+
url: `${BASE_URL}${path}`,
8+
lastModified: new Date(),
9+
changeFrequency: "weekly" as const,
10+
}));
11+
12+
const docsRoutes = source.getPages().map((page) => ({
13+
url: `${BASE_URL}${page.url}`,
14+
lastModified: page.data.lastModified,
15+
changeFrequency: "weekly" as const,
16+
}));
17+
18+
return [...staticRoutes, ...docsRoutes];
19+
}

docs/lib/source.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { type InferPageType, loader } from "fumadocs-core/source";
22
import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
33
import { docs } from "fumadocs-mdx:collections/server";
44

5+
export const BASE_URL = "https://www.openui.com";
6+
57
// See https://fumadocs.dev/docs/headless/source-api for more info
68
export const source = loader({
79
baseUrl: "/docs",

docs/source.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
22
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
3+
import lastModified from "fumadocs-mdx/plugins/last-modified";
34

45
// You can customise Zod schemas for frontmatter and `meta.json` here
56
// see https://fumadocs.dev/docs/mdx/collections
@@ -17,7 +18,5 @@ export const docs = defineDocs({
1718
});
1819

1920
export default defineConfig({
20-
mdxOptions: {
21-
// MDX options
22-
},
21+
plugins: [lastModified()],
2322
});

0 commit comments

Comments
 (0)