Skip to content

Commit

Permalink
feat: add content search
Browse files Browse the repository at this point in the history
  • Loading branch information
aliosmandev committed May 4, 2024
1 parent 1eb5889 commit dde32cb
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 86 deletions.
11 changes: 11 additions & 0 deletions apps/docs/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getPages } from "@/utils/source";
import { createSearchAPI } from "next-docs-zeta/search/server";

export const { GET } = createSearchAPI("advanced", {
indexes: getPages().map((page) => ({
title: page.data.title,
structuredData: page.data.exports.structuredData,
id: page.file.name,
url: page.url,
})),
});
40 changes: 0 additions & 40 deletions apps/docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
import { DocsLayout } from "fumadocs-ui/layout";
import { Metadata } from "next";
import { Suspense, type ReactNode } from "react";
import { Logo } from "../../components/logo";
import { pageTree } from "../../utils/source";

export const metadata: Metadata = {
title: {
default: "Postiva Client Documentation",
template: "%s - Postiva",
},
openGraph: {
title: "Postiva Client Documentation",
type: "website",
url: "https://docs.postiva.app/",
images: [
{
url: "/images/og_image.png",
width: 1200,
height: 630,
alt: "Postiva Client Documentation",
},
],
description: "Postiva Client Documentation",
siteName: "Postiva",
},
twitter: {
card: "summary_large_image",
site: "@Postiva",
title: "Postiva - Content Creation and Sharing Made Easy",
description:
"Discover Postiva's intuitive platform that simplifies content creation, management, and sharing for creators and businesses alike.",
images: ["/images/og_image.png"],
creator: "@postivaapp",
},
icons: [
{
rel: "icon",
type: "image/png",
url: "/favicon.ico",
},
],
metadataBase: new URL("https://docs.postiva.app"),
};

export default function RootDocsLayout({ children }: { children: ReactNode }) {
return (
<DocsLayout
Expand Down
43 changes: 43 additions & 0 deletions apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RootProvider } from "fumadocs-ui/provider";
import { Metadata } from "next";
import { Inter } from "next/font/google";
import type { ReactNode } from "react";
import "./global.css";
Expand All @@ -7,6 +8,48 @@ const inter = Inter({
subsets: ["latin"],
});

export const metadata: Metadata = {
title: {
default: "Postiva API Client - Official Documentation",
template: "%s - Postiva API Documentation",
},
description:
"Explore detailed documentation for the Postiva API Client, including setup, integration, and usage examples.",
openGraph: {
title: "Postiva API Client - Complete Guide",
type: "website",
url: "https://docs.postiva.app/",
images: [
{
url: "/og_image.png",
width: 1200,
height: 630,
alt: "Explore Postiva API Client",
},
],
description:
"Official documentation for the Postiva API Client, providing essential information on integration and usage.",
siteName: "Postiva Documentation",
},
twitter: {
card: "summary_large_image",
site: "@Postiva",
title: "Postiva API Client - Enhance Your Content Strategy",
description:
"Unlock powerful content management capabilities with Postiva's API Client. Learn how to integrate and use it effectively.",
images: ["/og_image.png"],
creator: "@postivaapp",
},
icons: [
{
rel: "icon",
type: "image/png",
url: "/favicon.ico",
},
],
metadataBase: new URL("https://docs.postiva.app"),
};

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className}>
Expand Down
11 changes: 9 additions & 2 deletions apps/docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ VITE_POSTIVA_WORKSPACE_ID=your-workspace-id

<Step>

### Initialize
### Initialize Client

<Tabs id="library" items={['Nextjs', 'Vite']}>
<Tab value="nextjs">
```ts title="libs/postiva.ts"
```ts twoslash title="libs/postiva.ts"
declare const process: {
env: {
NEXT_PUBLIC_POSTIVA_API_KEY: string;
NEXT_PUBLIC_WORKSPACE_ID: string;
};
};
// ---cut---
import { createClient } from '@postiva/client';

export const postivaClient = createClient({
Expand Down
11 changes: 11 additions & 0 deletions apps/docs/mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { cn } from "@/utils";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
import { Callout } from "fumadocs-ui/components/callout";
import {
CodeBlock,
Pre,
type CodeBlockProps,
} from "fumadocs-ui/components/codeblock";
import { Step, Steps } from "fumadocs-ui/components/steps";
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import { TypeTable } from "fumadocs-ui/components/type-table";
Expand All @@ -23,6 +29,11 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
Step,
Steps,
TypeTable,
pre: ({ title, className, icon, allowCopy, ...props }: CodeBlockProps) => (
<CodeBlock title={title} icon={icon} allowCopy={allowCopy}>
<Pre className={cn("max-h-[400px]", className)} {...props} />
</CodeBlock>
),
InstallTabs: ({
items,
children,
Expand Down
4 changes: 3 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"fumadocs-ui": "^11.0.4",
"lucide-react": "^0.378.0",
"next": "^14.0.4",
"next-docs-zeta": "6.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rehype-katex": "^7.0.0"
"rehype-katex": "^7.0.0",
"tailwind-merge": "^2.3.0"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
Expand Down
Binary file modified apps/docs/public/navbar_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/docs/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { twMerge as cn } from "tailwind-merge";
Loading

0 comments on commit dde32cb

Please sign in to comment.