@farming-labs/theme 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs-layout.d.mts +6 -10
- package/dist/docs-layout.mjs +11 -24
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/docs-layout.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import { DocsConfig } from "@farming-labs/docs";
|
|
3
|
+
import { DocsConfig, PageFrontmatter } from "@farming-labs/docs";
|
|
4
4
|
|
|
5
5
|
//#region src/docs-layout.d.ts
|
|
6
6
|
/**
|
|
@@ -16,23 +16,19 @@ import { DocsConfig } from "@farming-labs/docs";
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createDocsMetadata(config: DocsConfig): Record<string, unknown>;
|
|
18
18
|
/**
|
|
19
|
-
* Generate page-level metadata with dynamic OG
|
|
19
|
+
* Generate page-level metadata with dynamic or static OG/twitter.
|
|
20
|
+
* When the page has `openGraph` or `twitter` in frontmatter, those are used (static OG).
|
|
21
|
+
* Otherwise uses `ogImage` or the config dynamic endpoint.
|
|
20
22
|
*
|
|
21
23
|
* Usage in a docs page or [[...slug]] route:
|
|
22
24
|
* ```ts
|
|
23
25
|
* export function generateMetadata({ params }) {
|
|
24
26
|
* const page = getPage(params.slug);
|
|
25
|
-
* return createPageMetadata(docsConfig,
|
|
26
|
-
* title: page.data.title,
|
|
27
|
-
* description: page.data.description,
|
|
28
|
-
* });
|
|
27
|
+
* return createPageMetadata(docsConfig, page.data);
|
|
29
28
|
* }
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
|
-
declare function createPageMetadata(config: DocsConfig, page:
|
|
33
|
-
title: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
}): Record<string, unknown>;
|
|
31
|
+
declare function createPageMetadata(config: DocsConfig, page: Pick<PageFrontmatter, "title" | "description" | "ogImage" | "openGraph" | "twitter">, baseUrl?: string): Record<string, unknown>;
|
|
36
32
|
declare function createDocsLayout(config: DocsConfig): ({
|
|
37
33
|
children
|
|
38
34
|
}: {
|
package/dist/docs-layout.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import fs from "node:fs";
|
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import matter from "gray-matter";
|
|
10
10
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
11
|
+
import { buildPageOpenGraph, buildPageTwitter } from "@farming-labs/docs";
|
|
11
12
|
|
|
12
13
|
//#region src/docs-layout.tsx
|
|
13
14
|
/** Resolve a frontmatter `icon` string to a ReactNode via the icon registry. */
|
|
@@ -231,42 +232,28 @@ function createDocsMetadata(config) {
|
|
|
231
232
|
return result;
|
|
232
233
|
}
|
|
233
234
|
/**
|
|
234
|
-
* Generate page-level metadata with dynamic OG
|
|
235
|
+
* Generate page-level metadata with dynamic or static OG/twitter.
|
|
236
|
+
* When the page has `openGraph` or `twitter` in frontmatter, those are used (static OG).
|
|
237
|
+
* Otherwise uses `ogImage` or the config dynamic endpoint.
|
|
235
238
|
*
|
|
236
239
|
* Usage in a docs page or [[...slug]] route:
|
|
237
240
|
* ```ts
|
|
238
241
|
* export function generateMetadata({ params }) {
|
|
239
242
|
* const page = getPage(params.slug);
|
|
240
|
-
* return createPageMetadata(docsConfig,
|
|
241
|
-
* title: page.data.title,
|
|
242
|
-
* description: page.data.description,
|
|
243
|
-
* });
|
|
243
|
+
* return createPageMetadata(docsConfig, page.data);
|
|
244
244
|
* }
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
|
247
|
-
function createPageMetadata(config, page) {
|
|
248
|
-
const og = config.og;
|
|
247
|
+
function createPageMetadata(config, page, baseUrl) {
|
|
249
248
|
const result = {
|
|
250
249
|
title: page.title,
|
|
251
250
|
...page.description ? { description: page.description } : {}
|
|
252
251
|
};
|
|
253
|
-
if (og?.enabled !== false
|
|
254
|
-
const
|
|
255
|
-
result.openGraph =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
images: [{
|
|
259
|
-
url: ogUrl,
|
|
260
|
-
width: 1200,
|
|
261
|
-
height: 630
|
|
262
|
-
}]
|
|
263
|
-
};
|
|
264
|
-
result.twitter = {
|
|
265
|
-
card: "summary_large_image",
|
|
266
|
-
title: page.title,
|
|
267
|
-
description: page.description,
|
|
268
|
-
images: [ogUrl]
|
|
269
|
-
};
|
|
252
|
+
if (config.og?.enabled !== false) {
|
|
253
|
+
const openGraph = buildPageOpenGraph(page, config.og, baseUrl);
|
|
254
|
+
if (openGraph) result.openGraph = openGraph;
|
|
255
|
+
const twitter = buildPageTwitter(page, config.og, baseUrl);
|
|
256
|
+
if (twitter) result.twitter = twitter;
|
|
270
257
|
}
|
|
271
258
|
return result;
|
|
272
259
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,8 +5,8 @@ import { DocsPageClient } from "./docs-page-client.mjs";
|
|
|
5
5
|
import { RootProvider } from "./provider.mjs";
|
|
6
6
|
import { PageActions } from "./page-actions.mjs";
|
|
7
7
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
8
|
-
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
9
8
|
import { AIConfig, BreadcrumbConfig, CopyMarkdownConfig, DocsConfig, DocsMetadata, DocsNav, DocsTheme, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
9
|
+
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
10
10
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
11
11
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
|
|
12
12
|
export { type AIConfig, type BreadcrumbConfig, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, type CopyMarkdownConfig, DocsBody, DocsCommandSearch, type DocsConfig, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs };
|
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { createDocsLayout, createDocsMetadata, createPageMetadata } from "./docs
|
|
|
5
5
|
import { RootProvider } from "./provider.mjs";
|
|
6
6
|
import { DefaultUIDefaults, fumadocs } from "./default/index.mjs";
|
|
7
7
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
8
|
-
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
9
8
|
import { createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
9
|
+
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
10
10
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
11
11
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"next": ">=14.0.0",
|
|
104
104
|
"tsdown": "^0.20.3",
|
|
105
105
|
"typescript": "^5.9.3",
|
|
106
|
-
"@farming-labs/docs": "0.0.
|
|
106
|
+
"@farming-labs/docs": "0.0.11"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
109
|
"@farming-labs/docs": ">=0.0.1",
|