Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/next/app/global.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "tailwindcss";
@import "@farming-labs/theme/hardline/css";
@import "@farming-labs/theme/threadline/css";
4 changes: 2 additions & 2 deletions examples/next/docs.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Users,
Mail,
} from "lucide-react";
import { hardline } from "@farming-labs/theme/hardline";
import { threadline } from "@farming-labs/theme/threadline";

const typesenseBaseUrl = process.env.TYPESENSE_URL ?? process.env.TYPESENSE_BASE_URL;
const typesenseCollection = process.env.TYPESENSE_COLLECTION ?? "docs";
Expand Down Expand Up @@ -97,7 +97,7 @@ export default defineDocs({
baseBranch: "main",
},
},
theme: hardline(),
theme: threadline(),
ai: {
enabled: true,
// mode: "sidebar-icon",
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit/src/app.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "@farming-labs/theme/hardline/css";
@import "@farming-labs/theme/threadline/css";
4 changes: 2 additions & 2 deletions examples/sveltekit/src/lib/docs.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineDocs } from "@farming-labs/docs";
import { hardline } from "@farming-labs/svelte-theme/hardline";
import { threadline } from "@farming-labs/theme/threadline";

export default defineDocs({
entry: "docs",
contentDir: "docs",
theme: hardline(),
theme: threadline(),
github: {
url: "https://github.com/farming-labs/docs",
branch: "main",
Expand Down
70 changes: 70 additions & 0 deletions packages/fumadocs/src/docs-page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ interface TOCItem {
depth: number;
}

interface PageNavigationItem {
name: string;
url: string;
}

/** Serializable provider — icon is an HTML string, not JSX. */
interface SerializedProvider {
name: string;
Expand Down Expand Up @@ -83,6 +88,8 @@ interface DocsPageClientProps {
readingTime?: number | null;
/** Reading-time label style. */
readingTimeFormat?: ReadingTimeFormat;
previousPage?: PageNavigationItem | null;
nextPage?: PageNavigationItem | null;
/** Map of pathname → serialized Schema.org JSON-LD. */
structuredDataMap?: Record<string, string>;
/** Direct serialized Schema.org JSON-LD override for the current page. */
Expand Down Expand Up @@ -517,6 +524,8 @@ export function DocsPageClient({
readingTimeMap,
readingTime: readingTimeProp,
readingTimeFormat = "long",
previousPage,
nextPage,
structuredDataMap,
structuredData: structuredDataProp,
readingTimeEnabled = false,
Expand Down Expand Up @@ -785,6 +794,13 @@ export function DocsPageClient({
lastUpdatedLabelText && lastModified ? `${lastUpdatedLabelText} ${lastModified}` : lastModified;
const showFooter =
!isChangelogRoute && (!!githubFileUrl || showLastUpdatedInFooter || llmsTxtEnabled);
const localizedPreviousPage = previousPage?.url
? { ...previousPage, url: withLangInUrl(previousPage.url, activeLocale) }
: null;
const localizedNextPage = nextPage?.url
? { ...nextPage, url: withLangInUrl(nextPage.url, activeLocale) }
: null;
const showPageNavigation = !isChangelogRoute && (!!localizedPreviousPage || !!localizedNextPage);
const readingTimeBlock =
typeof resolvedReadingTime === "number" ? (
<div key="reading-time" className="fd-page-meta not-prose">
Expand Down Expand Up @@ -1033,6 +1049,60 @@ export function DocsPageClient({
)}
</div>
)}
{showPageNavigation && (
<nav
key="page-navigation"
className="not-prose fd-page-nav"
aria-label="Page navigation"
>
{localizedPreviousPage ? (
<a href={localizedPreviousPage.url} className="fd-page-nav-card fd-page-nav-prev">
<span className="fd-page-nav-title fd-page-nav-title-prev">
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<polyline points="15 18 9 12 15 6" />
</svg>
{localizedPreviousPage.name}
</span>
<span className="fd-page-nav-description">Previous Page</span>
</a>
) : (
<div aria-hidden="true" />
)}
{localizedNextPage ? (
<a href={localizedNextPage.url} className="fd-page-nav-card fd-page-nav-next">
<span className="fd-page-nav-title fd-page-nav-title-next">
{localizedNextPage.name}
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<polyline points="9 18 15 12 9 6" />
</svg>
</span>
<span className="fd-page-nav-description">Next Page</span>
</a>
) : (
<div aria-hidden="true" />
)}
</nav>
)}
</DocsBody>
</DocsPage>
</>
Expand Down
6 changes: 6 additions & 0 deletions packages/fumadocs/src/tanstack-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export interface TanstackDocsLayoutProps {
description?: string;
readingTime?: number | null;
lastModified?: string;
previousPage?: { name: string; url: string } | null;
nextPage?: { name: string; url: string } | null;
structuredData?: string;
editOnGithubUrl?: string;
children: ReactNode;
Expand Down Expand Up @@ -343,6 +345,8 @@ export function TanstackDocsLayout({
description,
readingTime,
lastModified,
previousPage,
nextPage,
structuredData,
editOnGithubUrl,
children,
Expand Down Expand Up @@ -549,6 +553,8 @@ export function TanstackDocsLayout({
lastUpdatedLabel={lastUpdatedLabel}
lastUpdatedPosition={lastUpdatedPosition}
lastModified={lastModified}
previousPage={previousPage}
nextPage={nextPage}
readingTimeEnabled={readingTimeEnabled}
readingTimeFormat={readingTimeOptions.format}
readingTime={typeof readingTime === "number" ? readingTime : undefined}
Expand Down
Loading
Loading