Skip to content

Commit dde32cb

Browse files
committed
feat: add content search
1 parent 1eb5889 commit dde32cb

File tree

9 files changed

+276
-86
lines changed

9 files changed

+276
-86
lines changed

apps/docs/app/api/search/route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { getPages } from "@/utils/source";
2+
import { createSearchAPI } from "next-docs-zeta/search/server";
3+
4+
export const { GET } = createSearchAPI("advanced", {
5+
indexes: getPages().map((page) => ({
6+
title: page.data.title,
7+
structuredData: page.data.exports.structuredData,
8+
id: page.file.name,
9+
url: page.url,
10+
})),
11+
});

apps/docs/app/docs/layout.tsx

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,8 @@
11
import { DocsLayout } from "fumadocs-ui/layout";
2-
import { Metadata } from "next";
32
import { Suspense, type ReactNode } from "react";
43
import { Logo } from "../../components/logo";
54
import { pageTree } from "../../utils/source";
65

7-
export const metadata: Metadata = {
8-
title: {
9-
default: "Postiva Client Documentation",
10-
template: "%s - Postiva",
11-
},
12-
openGraph: {
13-
title: "Postiva Client Documentation",
14-
type: "website",
15-
url: "https://docs.postiva.app/",
16-
images: [
17-
{
18-
url: "/images/og_image.png",
19-
width: 1200,
20-
height: 630,
21-
alt: "Postiva Client Documentation",
22-
},
23-
],
24-
description: "Postiva Client Documentation",
25-
siteName: "Postiva",
26-
},
27-
twitter: {
28-
card: "summary_large_image",
29-
site: "@Postiva",
30-
title: "Postiva - Content Creation and Sharing Made Easy",
31-
description:
32-
"Discover Postiva's intuitive platform that simplifies content creation, management, and sharing for creators and businesses alike.",
33-
images: ["/images/og_image.png"],
34-
creator: "@postivaapp",
35-
},
36-
icons: [
37-
{
38-
rel: "icon",
39-
type: "image/png",
40-
url: "/favicon.ico",
41-
},
42-
],
43-
metadataBase: new URL("https://docs.postiva.app"),
44-
};
45-
466
export default function RootDocsLayout({ children }: { children: ReactNode }) {
477
return (
488
<DocsLayout

apps/docs/app/layout.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { RootProvider } from "fumadocs-ui/provider";
2+
import { Metadata } from "next";
23
import { Inter } from "next/font/google";
34
import type { ReactNode } from "react";
45
import "./global.css";
@@ -7,6 +8,48 @@ const inter = Inter({
78
subsets: ["latin"],
89
});
910

11+
export const metadata: Metadata = {
12+
title: {
13+
default: "Postiva API Client - Official Documentation",
14+
template: "%s - Postiva API Documentation",
15+
},
16+
description:
17+
"Explore detailed documentation for the Postiva API Client, including setup, integration, and usage examples.",
18+
openGraph: {
19+
title: "Postiva API Client - Complete Guide",
20+
type: "website",
21+
url: "https://docs.postiva.app/",
22+
images: [
23+
{
24+
url: "/og_image.png",
25+
width: 1200,
26+
height: 630,
27+
alt: "Explore Postiva API Client",
28+
},
29+
],
30+
description:
31+
"Official documentation for the Postiva API Client, providing essential information on integration and usage.",
32+
siteName: "Postiva Documentation",
33+
},
34+
twitter: {
35+
card: "summary_large_image",
36+
site: "@Postiva",
37+
title: "Postiva API Client - Enhance Your Content Strategy",
38+
description:
39+
"Unlock powerful content management capabilities with Postiva's API Client. Learn how to integrate and use it effectively.",
40+
images: ["/og_image.png"],
41+
creator: "@postivaapp",
42+
},
43+
icons: [
44+
{
45+
rel: "icon",
46+
type: "image/png",
47+
url: "/favicon.ico",
48+
},
49+
],
50+
metadataBase: new URL("https://docs.postiva.app"),
51+
};
52+
1053
export default function Layout({ children }: { children: ReactNode }) {
1154
return (
1255
<html lang="en" className={inter.className}>

apps/docs/content/docs/index.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ VITE_POSTIVA_WORKSPACE_ID=your-workspace-id
5555

5656
<Step>
5757

58-
### Initialize
58+
### Initialize Client
5959

6060
<Tabs id="library" items={['Nextjs', 'Vite']}>
6161
<Tab value="nextjs">
62-
```ts title="libs/postiva.ts"
62+
```ts twoslash title="libs/postiva.ts"
63+
declare const process: {
64+
env: {
65+
NEXT_PUBLIC_POSTIVA_API_KEY: string;
66+
NEXT_PUBLIC_WORKSPACE_ID: string;
67+
};
68+
};
69+
// ---cut---
6370
import { createClient } from '@postiva/client';
6471

6572
export const postivaClient = createClient({

apps/docs/mdx-components.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
import { cn } from "@/utils";
12
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
23
import { Callout } from "fumadocs-ui/components/callout";
4+
import {
5+
CodeBlock,
6+
Pre,
7+
type CodeBlockProps,
8+
} from "fumadocs-ui/components/codeblock";
39
import { Step, Steps } from "fumadocs-ui/components/steps";
410
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
511
import { TypeTable } from "fumadocs-ui/components/type-table";
@@ -23,6 +29,11 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
2329
Step,
2430
Steps,
2531
TypeTable,
32+
pre: ({ title, className, icon, allowCopy, ...props }: CodeBlockProps) => (
33+
<CodeBlock title={title} icon={icon} allowCopy={allowCopy}>
34+
<Pre className={cn("max-h-[400px]", className)} {...props} />
35+
</CodeBlock>
36+
),
2637
InstallTabs: ({
2738
items,
2839
children,

apps/docs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
"fumadocs-ui": "^11.0.4",
1818
"lucide-react": "^0.378.0",
1919
"next": "^14.0.4",
20+
"next-docs-zeta": "6.0.2",
2021
"react": "^18.3.1",
2122
"react-dom": "^18.3.1",
22-
"rehype-katex": "^7.0.0"
23+
"rehype-katex": "^7.0.0",
24+
"tailwind-merge": "^2.3.0"
2325
},
2426
"devDependencies": {
2527
"@types/mdx": "^2.0.13",

apps/docs/public/navbar_logo.png

17.7 KB
Loading

apps/docs/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { twMerge as cn } from "tailwind-merge";

0 commit comments

Comments
 (0)