init: pusat bantuan tumbuhin
This commit is contained in:
5
app/api/search/route.ts
Normal file
5
app/api/search/route.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createFromSource } from 'fumadocs-core/search/server';
|
||||
import { source } from '@/lib/source';
|
||||
|
||||
// Pencarian bawaan (gratis, tanpa Algolia)
|
||||
export const { GET } = createFromSource(source);
|
||||
69
app/docs/[[...slug]]/page.tsx
Normal file
69
app/docs/[[...slug]]/page.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page';
|
||||
import { source } from '@/lib/source';
|
||||
import { getMDXComponents } from '@/mdx-components';
|
||||
import { SITE_NAME, SITE_URL } from '@/lib/site';
|
||||
|
||||
type Props = {
|
||||
params: Promise<{ slug?: string[] }>;
|
||||
};
|
||||
|
||||
export default async function Page(props: Props) {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound(); // status 404 yang benar
|
||||
|
||||
const MDXContent = page.data.body;
|
||||
|
||||
// Structured data (JSON-LD) untuk Google
|
||||
const jsonLd = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'TechArticle',
|
||||
headline: page.data.title,
|
||||
description: page.data.description,
|
||||
inLanguage: 'id-ID',
|
||||
mainEntityOfPage: `${SITE_URL}${page.url}`,
|
||||
publisher: { '@type': 'Organization', name: 'Tumbuhin' },
|
||||
};
|
||||
|
||||
return (
|
||||
<DocsPage toc={page.data.toc} full={page.data.full}>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
||||
/>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription>{page.data.description}</DocsDescription>
|
||||
<DocsBody>
|
||||
<MDXContent components={getMDXComponents()} />
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
);
|
||||
}
|
||||
|
||||
// Semua halaman di-generate statis saat build (terbaik untuk SEO)
|
||||
export async function generateStaticParams() {
|
||||
return source.generateParams();
|
||||
}
|
||||
|
||||
// Title, description, canonical, dan Open Graph per artikel dari front matter
|
||||
export async function generateMetadata(props: Props): Promise<Metadata> {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return {
|
||||
title: page.data.title,
|
||||
description: page.data.description,
|
||||
alternates: { canonical: page.url },
|
||||
openGraph: {
|
||||
type: 'article',
|
||||
url: page.url,
|
||||
title: page.data.title,
|
||||
description: page.data.description,
|
||||
siteName: SITE_NAME,
|
||||
locale: 'id_ID',
|
||||
},
|
||||
};
|
||||
}
|
||||
12
app/docs/layout.tsx
Normal file
12
app/docs/layout.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
|
||||
import type { ReactNode } from 'react';
|
||||
import { baseOptions } from '@/app/layout.config';
|
||||
import { source } from '@/lib/source';
|
||||
|
||||
export default function Layout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<DocsLayout tree={source.pageTree} {...baseOptions}>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
);
|
||||
}
|
||||
10
app/global.css
Normal file
10
app/global.css
Normal file
@@ -0,0 +1,10 @@
|
||||
@import 'tailwindcss';
|
||||
@import 'fumadocs-ui/css/neutral.css';
|
||||
@import 'fumadocs-ui/css/preset.css';
|
||||
|
||||
@source '../node_modules/fumadocs-ui/dist/**/*.js';
|
||||
|
||||
/* Warna brand Tumbuhin (biru) */
|
||||
:root {
|
||||
--color-fd-primary: hsl(199, 98%, 48%);
|
||||
}
|
||||
14
app/layout.config.tsx
Normal file
14
app/layout.config.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
|
||||
|
||||
export const baseOptions: BaseLayoutProps = {
|
||||
nav: {
|
||||
title: 'Tumbuhin Bantuan',
|
||||
},
|
||||
links: [
|
||||
{
|
||||
text: 'Login POS',
|
||||
url: 'https://pos.tumbuhindigital.com/login',
|
||||
external: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
41
app/layout.tsx
Normal file
41
app/layout.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import './global.css';
|
||||
import { RootProvider } from 'fumadocs-ui/provider';
|
||||
import { Inter } from 'next/font/google';
|
||||
import type { Metadata } from 'next';
|
||||
import type { ReactNode } from 'react';
|
||||
import { SITE_NAME, SITE_URL } from '@/lib/site';
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
metadataBase: new URL(SITE_URL),
|
||||
title: {
|
||||
default: SITE_NAME,
|
||||
template: `%s | ${SITE_NAME}`,
|
||||
},
|
||||
description:
|
||||
'Panduan lengkap menggunakan Tumbuhin POS: login, transaksi, produk, stok, dan Pop-Up Event.',
|
||||
openGraph: {
|
||||
siteName: SITE_NAME,
|
||||
locale: 'id_ID',
|
||||
type: 'website',
|
||||
},
|
||||
// Isi kode verifikasi Google Search Console di sini saat produksi
|
||||
// verification: { google: 'KODE_VERIFIKASI' },
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="id" className={inter.className} suppressHydrationWarning>
|
||||
<body className="flex flex-col min-h-screen">
|
||||
<RootProvider
|
||||
search={{
|
||||
options: { api: '/api/search' },
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</RootProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
22
app/page.tsx
Normal file
22
app/page.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import Link from 'next/link';
|
||||
import { HomeLayout } from 'fumadocs-ui/layouts/home';
|
||||
import { baseOptions } from './layout.config';
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<HomeLayout {...baseOptions}>
|
||||
<main className="flex flex-1 flex-col items-center justify-center px-4 py-24 text-center">
|
||||
<h1 className="mb-4 text-3xl font-bold">Pusat Bantuan Tumbuhin POS</h1>
|
||||
<p className="mb-8 max-w-xl text-fd-muted-foreground">
|
||||
Panduan langkah demi langkah untuk mengelola usaha Anda dengan Tumbuhin POS.
|
||||
</p>
|
||||
<Link
|
||||
href="/docs"
|
||||
className="rounded-lg bg-fd-primary px-6 py-3 font-medium text-fd-primary-foreground"
|
||||
>
|
||||
Lihat Panduan
|
||||
</Link>
|
||||
</main>
|
||||
</HomeLayout>
|
||||
);
|
||||
}
|
||||
14
app/robots.ts
Normal file
14
app/robots.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { MetadataRoute } from 'next';
|
||||
import { SITE_URL } from '@/lib/site';
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return {
|
||||
rules: {
|
||||
userAgent: '*',
|
||||
allow: '/',
|
||||
// Dashboard writer & API tidak perlu masuk Google
|
||||
disallow: ['/admin', '/api'],
|
||||
},
|
||||
sitemap: `${SITE_URL}/sitemap.xml`,
|
||||
};
|
||||
}
|
||||
17
app/sitemap.ts
Normal file
17
app/sitemap.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { MetadataRoute } from 'next';
|
||||
import { source } from '@/lib/source';
|
||||
import { SITE_URL } from '@/lib/site';
|
||||
|
||||
// Otomatis: setiap file .mdx baru langsung masuk sitemap
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const pages = source.getPages().map((page) => ({
|
||||
url: `${SITE_URL}${page.url}`,
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.8,
|
||||
}));
|
||||
|
||||
return [
|
||||
{ url: SITE_URL, changeFrequency: 'monthly', priority: 1 },
|
||||
...pages,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user