@vercel/geistdocs 1.2.1 → 1.2.3-canary.48fea3c
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/cli/index.js +3 -0
- package/dist/components/callout.d.ts +12 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +7 -0
- package/dist/components/code-block-tabs.d.ts +7 -0
- package/dist/components/code-block-tabs.d.ts.map +1 -0
- package/dist/components/code-block-tabs.js +7 -0
- package/dist/components/code-block.d.ts +14 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +45 -0
- package/dist/components/copy-prompt.d.ts +11 -0
- package/dist/components/copy-prompt.d.ts.map +1 -0
- package/dist/components/copy-prompt.js +58 -0
- package/dist/components/mermaid.d.ts +4 -0
- package/dist/components/mermaid.d.ts.map +1 -0
- package/dist/components/mermaid.js +44 -0
- package/dist/components/theme-aware-image.d.ts +12 -0
- package/dist/components/theme-aware-image.d.ts.map +1 -0
- package/dist/components/theme-aware-image.js +8 -0
- package/dist/components/video.d.ts +6 -0
- package/dist/components/video.d.ts.map +1 -0
- package/dist/components/video.js +3 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/controls.d.ts +15 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +52 -0
- package/dist/internal/chat/context.d.ts +19 -0
- package/dist/internal/chat/context.d.ts.map +1 -0
- package/dist/internal/chat/context.js +36 -0
- package/dist/internal/chat/conversation.d.ts +10 -0
- package/dist/internal/chat/conversation.d.ts.map +1 -0
- package/dist/internal/chat/conversation.js +16 -0
- package/dist/internal/chat/copy-chat.d.ts +5 -0
- package/dist/internal/chat/copy-chat.d.ts.map +1 -0
- package/dist/internal/chat/copy-chat.js +35 -0
- package/dist/internal/chat/db.d.ts +13 -0
- package/dist/internal/chat/db.d.ts.map +1 -0
- package/dist/internal/chat/db.js +19 -0
- package/dist/internal/chat/message-metadata.d.ts +8 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -0
- package/dist/internal/chat/message-metadata.js +29 -0
- package/dist/internal/chat/message.d.ts +11 -0
- package/dist/internal/chat/message.d.ts.map +1 -0
- package/dist/internal/chat/message.js +11 -0
- package/dist/internal/chat/prompt-input.d.ts +13 -0
- package/dist/internal/chat/prompt-input.d.ts.map +1 -0
- package/dist/internal/chat/prompt-input.js +39 -0
- package/dist/internal/chat/shell.d.ts +2 -0
- package/dist/internal/chat/shell.d.ts.map +1 -0
- package/dist/internal/chat/shell.js +194 -0
- package/dist/internal/chat/shimmer.d.ts +11 -0
- package/dist/internal/chat/shimmer.d.ts.map +1 -0
- package/dist/internal/chat/shimmer.js +18 -0
- package/dist/internal/chat/sources.d.ts +13 -0
- package/dist/internal/chat/sources.d.ts.map +1 -0
- package/dist/internal/chat/sources.js +9 -0
- package/dist/internal/chat/suggestion.d.ts +11 -0
- package/dist/internal/chat/suggestion.d.ts.map +1 -0
- package/dist/internal/chat/suggestion.js +12 -0
- package/dist/internal/cn.d.ts +3 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/cn.js +3 -0
- package/dist/internal/feedback-action.d.ts +14 -0
- package/dist/internal/feedback-action.d.ts.map +1 -0
- package/dist/internal/feedback-action.js +34 -0
- package/dist/internal/i18n.d.ts +6 -0
- package/dist/internal/i18n.d.ts.map +1 -0
- package/dist/internal/i18n.js +18 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.d.ts.map +1 -0
- package/dist/internal/languages.js +18 -0
- package/dist/internal/not-implemented.d.ts +2 -0
- package/dist/internal/not-implemented.d.ts.map +1 -0
- package/dist/internal/not-implemented.js +4 -0
- package/dist/internal/page-actions-client.d.ts +13 -0
- package/dist/internal/page-actions-client.d.ts.map +1 -0
- package/dist/internal/page-actions-client.js +160 -0
- package/dist/internal/page-actions.d.ts +18 -0
- package/dist/internal/page-actions.d.ts.map +1 -0
- package/dist/internal/page-actions.js +4 -0
- package/dist/internal/provider-client.d.ts +9 -0
- package/dist/internal/provider-client.d.ts.map +1 -0
- package/dist/internal/provider-client.js +23 -0
- package/dist/internal/search.d.ts +5 -0
- package/dist/internal/search.d.ts.map +1 -0
- package/dist/internal/search.js +14 -0
- package/dist/internal/sidebar.d.ts +9 -0
- package/dist/internal/sidebar.d.ts.map +1 -0
- package/dist/internal/sidebar.js +38 -0
- package/dist/internal/table-of-contents.d.ts +9 -0
- package/dist/internal/table-of-contents.d.ts.map +1 -0
- package/dist/internal/table-of-contents.js +5 -0
- package/dist/internal/ui/button-group.d.ts +13 -0
- package/dist/internal/ui/button-group.d.ts.map +1 -0
- package/dist/internal/ui/button-group.js +26 -0
- package/dist/internal/ui/button.d.ts +12 -0
- package/dist/internal/ui/button.d.ts.map +1 -0
- package/dist/internal/ui/button.js +33 -0
- package/dist/internal/ui/card.d.ts +6 -0
- package/dist/internal/ui/card.d.ts.map +1 -0
- package/dist/internal/ui/card.js +14 -0
- package/dist/internal/ui/collapsible.d.ts +6 -0
- package/dist/internal/ui/collapsible.d.ts.map +1 -0
- package/dist/internal/ui/collapsible.js +12 -0
- package/dist/internal/ui/drawer.d.ts +6 -0
- package/dist/internal/ui/drawer.d.ts.map +1 -0
- package/dist/internal/ui/drawer.js +13 -0
- package/dist/internal/ui/dropdown-menu.d.ts +22 -0
- package/dist/internal/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/internal/ui/dropdown-menu.js +41 -0
- package/dist/internal/ui/input-group.d.ts +15 -0
- package/dist/internal/ui/input-group.d.ts.map +1 -0
- package/dist/internal/ui/input-group.js +44 -0
- package/dist/internal/ui/input.d.ts +3 -0
- package/dist/internal/ui/input.d.ts.map +1 -0
- package/dist/internal/ui/input.js +5 -0
- package/dist/internal/ui/kbd.d.ts +4 -0
- package/dist/internal/ui/kbd.d.ts.map +1 -0
- package/dist/internal/ui/kbd.js +8 -0
- package/dist/internal/ui/popover.d.ts +6 -0
- package/dist/internal/ui/popover.d.ts.map +1 -0
- package/dist/internal/ui/popover.js +13 -0
- package/dist/internal/ui/scroll-area.d.ts +5 -0
- package/dist/internal/ui/scroll-area.d.ts.map +1 -0
- package/dist/internal/ui/scroll-area.js +12 -0
- package/dist/internal/ui/separator.d.ts +4 -0
- package/dist/internal/ui/separator.d.ts.map +1 -0
- package/dist/internal/ui/separator.js +7 -0
- package/dist/internal/ui/sheet.d.ts +10 -0
- package/dist/internal/ui/sheet.d.ts.map +1 -0
- package/dist/internal/ui/sheet.js +24 -0
- package/dist/internal/ui/sonner.d.ts +3 -0
- package/dist/internal/ui/sonner.d.ts.map +1 -0
- package/dist/internal/ui/sonner.js +20 -0
- package/dist/internal/ui/spinner.d.ts +3 -0
- package/dist/internal/ui/spinner.d.ts.map +1 -0
- package/dist/internal/ui/spinner.js +6 -0
- package/dist/internal/ui/textarea.d.ts +3 -0
- package/dist/internal/ui/textarea.d.ts.map +1 -0
- package/dist/internal/ui/textarea.js +5 -0
- package/dist/internal/ui/tooltip.d.ts +7 -0
- package/dist/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/internal/ui/tooltip.js +16 -0
- package/dist/internal/use-mobile.d.ts +2 -0
- package/dist/internal/use-mobile.d.ts.map +1 -0
- package/dist/internal/use-mobile.js +16 -0
- package/dist/layout.d.ts +14 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +31 -0
- package/dist/mdx.d.ts +36 -0
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +74 -0
- package/dist/pages/docs.d.ts +77 -0
- package/dist/pages/docs.d.ts.map +1 -0
- package/dist/pages/docs.js +92 -0
- package/dist/proxy.d.ts +37 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +162 -0
- package/dist/routes/chat.d.ts +14 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +242 -0
- package/dist/routes/llms.d.ts +51 -0
- package/dist/routes/llms.d.ts.map +1 -0
- package/dist/routes/llms.js +59 -0
- package/dist/routes/search.d.ts +11 -0
- package/dist/routes/search.d.ts.map +1 -0
- package/dist/routes/search.js +74 -0
- package/dist/routes/sitemap.d.ts +44 -0
- package/dist/routes/sitemap.d.ts.map +1 -0
- package/dist/routes/sitemap.js +168 -0
- package/dist/sidebar.d.ts +11 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +16 -0
- package/dist/source.d.ts +174 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +129 -0
- package/dist/versions.d.ts +15 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +52 -0
- package/package.json +141 -9
- package/styles.css +193 -0
- package/template/_gitignore +29 -0
- package/template/app/[lang]/(home)/components/centered-section.tsx +26 -0
- package/template/app/[lang]/(home)/components/cta.tsx +19 -0
- package/template/app/[lang]/(home)/components/hero.tsx +27 -0
- package/template/app/[lang]/(home)/components/one-two-section.tsx +25 -0
- package/template/app/[lang]/(home)/components/templates.tsx +50 -0
- package/template/app/[lang]/(home)/components/text-grid-section.tsx +20 -0
- package/template/app/[lang]/(home)/layout.tsx +14 -0
- package/template/app/[lang]/(home)/page.tsx +126 -0
- package/template/app/[lang]/docs/[[...slug]]/page.tsx +19 -0
- package/template/app/[lang]/docs/layout.tsx +14 -0
- package/template/app/[lang]/layout.tsx +29 -0
- package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +7 -0
- package/template/app/[lang]/llms.txt/route.ts +6 -0
- package/template/app/[lang]/og/[...slug]/background.png +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-regular.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/route.tsx +95 -0
- package/template/app/[lang]/rss.xml/route.ts +52 -0
- package/template/app/[lang]/sitemap.md/route.ts +9 -0
- package/template/app/actions/feedback/emotions.ts +18 -0
- package/template/app/actions/feedback/index.ts +45 -0
- package/template/app/api/chat/route.ts +8 -0
- package/template/app/api/search/route.ts +5 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/global.css +2 -0
- package/template/app/robots.ts +14 -0
- package/template/app/sitemap.ts +36 -0
- package/template/app/styles/geistdocs.css +554 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right-small.tsx +35 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-check.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-down-small.tsx +30 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-copy.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-file-text.tsx +25 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-menu-alt.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-slash-forward.tsx +36 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/index.tsx +11 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/index.tsx +14 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-elements.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-sdk.tsx +38 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-chat-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-flags-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-icon-vercel.tsx +31 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-streamdown.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-vercel-oss.tsx +24 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-workflow-sdk.tsx +73 -0
- package/template/components/geistdocs/callout.tsx +40 -0
- package/template/components/geistdocs/chat.tsx +24 -0
- package/template/components/geistdocs/code-block-tabs.tsx +61 -0
- package/template/components/geistdocs/code-block.tsx +134 -0
- package/template/components/geistdocs/copy-page.tsx +27 -0
- package/template/components/geistdocs/desktop-menu.tsx +52 -0
- package/template/components/geistdocs/docs-layout.tsx +20 -0
- package/template/components/geistdocs/docs-page.tsx +35 -0
- package/template/components/geistdocs/edit-source.tsx +30 -0
- package/template/components/geistdocs/feedback.tsx +139 -0
- package/template/components/geistdocs/footer.tsx +30 -0
- package/template/components/geistdocs/github-button.tsx +19 -0
- package/template/components/geistdocs/home-layout.tsx +46 -0
- package/template/components/geistdocs/icons.tsx +13 -0
- package/template/components/geistdocs/installer.tsx +58 -0
- package/template/components/geistdocs/language-selector.tsx +3 -0
- package/template/components/geistdocs/mdx-components.tsx +5 -0
- package/template/components/geistdocs/mermaid.tsx +68 -0
- package/template/components/geistdocs/mobile-docs-bar.tsx +77 -0
- package/template/components/geistdocs/mobile-menu.tsx +150 -0
- package/template/components/geistdocs/navbar-logo.tsx +124 -0
- package/template/components/geistdocs/navbar.tsx +22 -0
- package/template/components/geistdocs/provider.tsx +31 -0
- package/template/components/geistdocs/rss-button.tsx +10 -0
- package/template/components/geistdocs/scroll-top.tsx +21 -0
- package/template/components/geistdocs/search.tsx +17 -0
- package/template/components/geistdocs/sidebar.tsx +128 -0
- package/template/components/geistdocs/theme-aware-image.tsx +22 -0
- package/template/components/geistdocs/theme-toggle.tsx +3 -0
- package/template/components/geistdocs/video.tsx +16 -0
- package/template/components/ui/badge.tsx +46 -0
- package/template/components/ui/button-group.tsx +83 -0
- package/template/components/ui/button.tsx +60 -0
- package/template/components/ui/card.tsx +92 -0
- package/template/components/ui/collapsible.tsx +33 -0
- package/template/components/ui/command-prompt.tsx +488 -0
- package/template/components/ui/command.tsx +184 -0
- package/template/components/ui/dialog.tsx +143 -0
- package/template/components/ui/drawer.tsx +135 -0
- package/template/components/ui/dropdown-menu.tsx +257 -0
- package/template/components/ui/hover-card.tsx +44 -0
- package/template/components/ui/input-group.tsx +170 -0
- package/template/components/ui/input.tsx +21 -0
- package/template/components/ui/kbd.tsx +28 -0
- package/template/components/ui/navigation-menu.tsx +192 -0
- package/template/components/ui/popover.tsx +48 -0
- package/template/components/ui/scroll-area.tsx +58 -0
- package/template/components/ui/select.tsx +187 -0
- package/template/components/ui/separator.tsx +28 -0
- package/template/components/ui/sheet.tsx +139 -0
- package/template/components/ui/sonner.tsx +40 -0
- package/template/components/ui/spinner.tsx +16 -0
- package/template/components/ui/textarea.tsx +18 -0
- package/template/components/ui/tooltip.tsx +61 -0
- package/template/components.json +22 -0
- package/template/content/docs/ask-ai.cn.mdx +85 -0
- package/template/content/docs/ask-ai.mdx +89 -0
- package/template/content/docs/configuration.cn.mdx +155 -0
- package/template/content/docs/configuration.mdx +200 -0
- package/template/content/docs/deployment.cn.mdx +34 -0
- package/template/content/docs/deployment.mdx +40 -0
- package/template/content/docs/edit-on-github.cn.mdx +47 -0
- package/template/content/docs/edit-on-github.mdx +51 -0
- package/template/content/docs/env.cn.mdx +25 -0
- package/template/content/docs/env.mdx +29 -0
- package/template/content/docs/feedback.cn.mdx +85 -0
- package/template/content/docs/feedback.mdx +89 -0
- package/template/content/docs/getting-started.cn.mdx +86 -0
- package/template/content/docs/getting-started.mdx +107 -0
- package/template/content/docs/index.cn.mdx +57 -0
- package/template/content/docs/index.mdx +92 -0
- package/template/content/docs/internationalization.cn.mdx +111 -0
- package/template/content/docs/internationalization.mdx +122 -0
- package/template/content/docs/llms-txt.cn.mdx +72 -0
- package/template/content/docs/llms-txt.mdx +85 -0
- package/template/content/docs/md.cn.mdx +65 -0
- package/template/content/docs/md.mdx +81 -0
- package/template/content/docs/meta.json +23 -0
- package/template/content/docs/open-in-chat.cn.mdx +78 -0
- package/template/content/docs/open-in-chat.mdx +80 -0
- package/template/content/docs/provider.cn.mdx +70 -0
- package/template/content/docs/provider.mdx +74 -0
- package/template/content/docs/proxy.cn.mdx +96 -0
- package/template/content/docs/proxy.mdx +124 -0
- package/template/content/docs/rss.cn.mdx +104 -0
- package/template/content/docs/rss.mdx +108 -0
- package/template/content/docs/syntax.cn.mdx +416 -0
- package/template/content/docs/syntax.mdx +411 -0
- package/template/content/docs/theme-aware-image.mdx +57 -0
- package/template/content/docs/versioned-docs.cn.mdx +117 -0
- package/template/content/docs/versioned-docs.mdx +181 -0
- package/template/geistdocs.tsx +51 -0
- package/template/hooks/geistdocs/use-sidebar.ts +13 -0
- package/template/hooks/use-mobile.ts +19 -0
- package/template/lib/geistdocs/config.tsx +27 -0
- package/template/lib/geistdocs/fonts.ts +18 -0
- package/template/lib/geistdocs/i18n.ts +13 -0
- package/template/lib/geistdocs/md-tracking.ts +56 -0
- package/template/lib/geistdocs/source.ts +12 -0
- package/template/lib/utils.ts +6 -0
- package/template/next.config.ts +22 -0
- package/template/package.json +63 -0
- package/template/postcss.config.mjs +5 -0
- package/template/proxy.ts +18 -0
- package/template/source.config.ts +62 -0
- package/template/tsconfig.json +37 -0
- package/dist/index.js +0 -2
- /package/dist/{index.d.ts → cli/index.d.ts} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Feedback
|
|
3
|
+
description: Collect user feedback with an interactive emotion-based widget that creates GitHub Issues
|
|
4
|
+
type: integration
|
|
5
|
+
summary: An interactive feedback widget that collects user sentiment and creates structured GitHub Issues automatically.
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/getting-started
|
|
8
|
+
related:
|
|
9
|
+
- /docs/provider
|
|
10
|
+
- /docs/configuration
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
The Feedback feature lets readers share page-level feedback through an interactive widget. Feedback is posted to a centralized GitHub repository as issues so your team can track, label, and respond to user input.
|
|
14
|
+
|
|
15
|
+
<CopyPrompt text="Help me configure feedback for this Geistdocs project. Check whether feedback is enabled, what siteId label is used, and how feedback is sent to the Geistdocs platform and GitHub issues.">
|
|
16
|
+
Help me configure feedback for this Geistdocs project. Check whether feedback is enabled, what `siteId` label is used, and how feedback is sent to the Geistdocs platform and GitHub issues.
|
|
17
|
+
</CopyPrompt>
|
|
18
|
+
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
The feedback widget appears in the table of contents sidebar on every documentation page. When users click "Give feedback", they can:
|
|
22
|
+
|
|
23
|
+
1. Write their feedback message
|
|
24
|
+
2. Select an emotion that represents their experience (🤩, 🙂, 😕, 😭)
|
|
25
|
+
3. Optionally provide their name and email
|
|
26
|
+
4. Submit their feedback
|
|
27
|
+
|
|
28
|
+
### Feedback Workflow
|
|
29
|
+
|
|
30
|
+
When feedback is submitted:
|
|
31
|
+
|
|
32
|
+
1. The feedback is validated against a JSON schema
|
|
33
|
+
2. A new GitHub Issue is created in the configured feedback repository
|
|
34
|
+
3. Labels are automatically applied based on the emotion, topic, and other metadata
|
|
35
|
+
4. User details and metadata are formatted into a structured markdown table
|
|
36
|
+
|
|
37
|
+
Each piece of feedback creates a separate issue, allowing for individual tracking and resolution.
|
|
38
|
+
|
|
39
|
+
## Feedback Schema
|
|
40
|
+
|
|
41
|
+
The API accepts the following fields:
|
|
42
|
+
|
|
43
|
+
| Field | Type | Required | Max Length | Description |
|
|
44
|
+
| --------- | ------ | -------- | ---------- | ------------------------------------- |
|
|
45
|
+
| `note` | string | Yes | 16,384 | The feedback message |
|
|
46
|
+
| `url` | string | No | 1,024 | Page URL where feedback was submitted |
|
|
47
|
+
| `emotion` | string | No | 1 | Emoji representing user sentiment |
|
|
48
|
+
| `topic` | string | No | 1,024 | Feedback topic/category |
|
|
49
|
+
| `name` | string | No | 1,024 | User's name |
|
|
50
|
+
| `email` | string | No | 1,024 | User's email |
|
|
51
|
+
| `ua` | string | No | 256 | User agent string |
|
|
52
|
+
| `label` | string | No | 64 | Custom label for the issue |
|
|
53
|
+
| `thumbs` | string | No | 4 | Thumbs up/down indicator |
|
|
54
|
+
| `reason` | string | No | 10 | Reason for thumbs down |
|
|
55
|
+
| `plan` | string | No | 10 | User's plan type |
|
|
56
|
+
|
|
57
|
+
Additional fields are captured as metadata and displayed in the issue body.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
### Automatic Labeling
|
|
62
|
+
|
|
63
|
+
Issues are automatically labeled based on:
|
|
64
|
+
|
|
65
|
+
- **Emotion**: `emotion-amazed`, `emotion-happy`, `emotion-sad`, `emotion-cry`
|
|
66
|
+
- **Topic**: `topic-{topic-name}`
|
|
67
|
+
- **Plan**: `{plan}-plan`
|
|
68
|
+
- **Thumbs**: `thumbs-up`, `thumbs-down`
|
|
69
|
+
- **Reason**: `reason-{reason}` (for thumbs down)
|
|
70
|
+
- **Custom labels**: Any label passed via the `label` field
|
|
71
|
+
- **Default labels**: `unresolved`, `vercel-site`
|
|
72
|
+
|
|
73
|
+
### Structured Issue Body
|
|
74
|
+
|
|
75
|
+
Each issue includes a formatted markdown body with:
|
|
76
|
+
|
|
77
|
+
- The feedback note
|
|
78
|
+
- URL where feedback was submitted
|
|
79
|
+
- User details table (email, context, IP, user agent)
|
|
80
|
+
- Metadata table for any additional fields
|
|
81
|
+
|
|
82
|
+
### Metadata Support
|
|
83
|
+
|
|
84
|
+
Pass any additional fields in the request body, and they are captured as metadata and displayed in a separate table in the issue. This allows you to include:
|
|
85
|
+
|
|
86
|
+
- User IDs
|
|
87
|
+
- Feature flags
|
|
88
|
+
- Experiment groups
|
|
89
|
+
- Custom tracking data
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 入门指南
|
|
3
|
+
description: 关于 Geistdocs 的全面入门指南
|
|
4
|
+
type: guide
|
|
5
|
+
summary: 创建新的 Geistdocs 项目、配置环境变量并创建您的第一个文档页面。
|
|
6
|
+
related:
|
|
7
|
+
- /docs/env
|
|
8
|
+
- /docs/syntax
|
|
9
|
+
- /docs/deployment
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
本指南将引导您完成设置和自定义文档站点所需的所有内容。
|
|
13
|
+
|
|
14
|
+
## 先决条件
|
|
15
|
+
|
|
16
|
+
开始之前,请确保您具备:
|
|
17
|
+
|
|
18
|
+
- **Node.js 18+** 已在您的系统上安装
|
|
19
|
+
- **pnpm**(推荐)或您喜欢的 **npm** 包管理器
|
|
20
|
+
- **GitHub 账户** 用于仓库托管
|
|
21
|
+
- 对 **MDX**、**Next.js** 和 **React** 有基本了解
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
24
|
+
|
|
25
|
+
### 1. 创建新项目
|
|
26
|
+
|
|
27
|
+
使用 Geistdocs CLI 创建新项目:
|
|
28
|
+
|
|
29
|
+
```bash title="Terminal"
|
|
30
|
+
npx @vercel/geistdocs init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
这将把 Geistdocs 的 `template` 应用克隆到一个新目录。它会提示您输入项目名称,然后安装所有依赖并删除 Geistdocs 网站内容。
|
|
34
|
+
|
|
35
|
+
### 2. 配置环境变量
|
|
36
|
+
|
|
37
|
+
复制示例环境文件:
|
|
38
|
+
|
|
39
|
+
```bash title="Terminal"
|
|
40
|
+
cp .env.example .env.local
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
然后编辑 `.env.local` 文件中的环境变量。您可以在 [环境变量](/docs/env) 部分了解有关环境变量的更多信息。
|
|
44
|
+
|
|
45
|
+
### 3. 启动开发服务器
|
|
46
|
+
|
|
47
|
+
运行开发服务器:
|
|
48
|
+
|
|
49
|
+
```bash title="Terminal"
|
|
50
|
+
pnpm dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
在浏览器中打开 [http://localhost:3000](http://localhost:3000) 来查看您的文档站点。
|
|
54
|
+
|
|
55
|
+
### 4. 创建新页面
|
|
56
|
+
|
|
57
|
+
在 `content/docs/` 中创建一个新文件:
|
|
58
|
+
|
|
59
|
+
````mdx title="content/docs/my-first-page.mdx"
|
|
60
|
+
---
|
|
61
|
+
title: 我的第一页
|
|
62
|
+
description: 这是我的第一个文档页面
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# My First Page
|
|
66
|
+
|
|
67
|
+
Welcome to my documentation! Find this page at `/docs/my-first-page`.
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
- Easy to write with Markdown
|
|
72
|
+
- Full React component support
|
|
73
|
+
- Automatic navigation generation
|
|
74
|
+
|
|
75
|
+
## Code Example
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const greeting = (name: string): string => {
|
|
79
|
+
return `Hello, ${name}!`;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
console.log(greeting("World"));
|
|
83
|
+
```
|
|
84
|
+
````
|
|
85
|
+
|
|
86
|
+
在 [语法](/docs/syntax) 部分了解有关可用语法的更多信息。
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
description: Create a Geistdocs project and start writing documentation
|
|
4
|
+
type: guide
|
|
5
|
+
summary: Create a Geistdocs project, run it locally, and edit your first documentation page.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/configuration
|
|
8
|
+
- /docs/syntax
|
|
9
|
+
- /docs/deployment
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Create a Geistdocs site with the package CLI, then edit the generated content and configuration files. The generated project includes these docs so you can use them as a reference while you build.
|
|
13
|
+
|
|
14
|
+
<CopyPrompt text="Create a Geistdocs project with pnpm dlx @vercel/geistdocs init --name my-docs. Then open my-docs, run pnpm dev, and explain which files I should edit first: geistdocs.tsx, content/docs, content/docs/meta.json, and components/geistdocs/mdx-components.tsx.">
|
|
15
|
+
Create a Geistdocs project with `pnpm dlx @vercel/geistdocs init --name my-docs`. Then open `my-docs`, run `pnpm dev`, and explain which files I should edit first: `geistdocs.tsx`, `content/docs`, `content/docs/meta.json`, and `components/geistdocs/mdx-components.tsx`.
|
|
16
|
+
</CopyPrompt>
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
Before you begin, install:
|
|
21
|
+
|
|
22
|
+
- Node.js 18 or later
|
|
23
|
+
- pnpm, npm, or another package manager
|
|
24
|
+
- Git
|
|
25
|
+
|
|
26
|
+
## Create a project
|
|
27
|
+
|
|
28
|
+
Run the Geistdocs CLI from an empty parent folder:
|
|
29
|
+
|
|
30
|
+
```bash title="Terminal"
|
|
31
|
+
pnpm dlx @vercel/geistdocs init --name my-docs
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can also use npm:
|
|
35
|
+
|
|
36
|
+
```bash title="Terminal"
|
|
37
|
+
npx @vercel/geistdocs init --name my-docs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The CLI copies the template bundled in the package, rewrites the generated app to depend on the same `@vercel/geistdocs` version, installs dependencies, copies `.env.example` to `.env.local`, and initializes Git.
|
|
41
|
+
|
|
42
|
+
## Start the development server
|
|
43
|
+
|
|
44
|
+
Open the generated project and start Next.js:
|
|
45
|
+
|
|
46
|
+
```bash title="Terminal"
|
|
47
|
+
cd my-docs
|
|
48
|
+
pnpm dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Open `http://localhost:3000` in your browser.
|
|
52
|
+
|
|
53
|
+
## Edit your first page
|
|
54
|
+
|
|
55
|
+
Docs live in `content/docs`. Edit the overview page:
|
|
56
|
+
|
|
57
|
+
```mdx title="content/docs/index.mdx"
|
|
58
|
+
---
|
|
59
|
+
title: Overview
|
|
60
|
+
description: Learn how to use my project.
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
My project helps developers build with clear documentation.
|
|
64
|
+
|
|
65
|
+
## Start here
|
|
66
|
+
|
|
67
|
+
Add the first workflow you want readers to complete.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Add more pages by creating new `.mdx` files in `content/docs`.
|
|
71
|
+
|
|
72
|
+
## Update the sidebar
|
|
73
|
+
|
|
74
|
+
Use `content/docs/meta.json` to control page order and groups:
|
|
75
|
+
|
|
76
|
+
```json title="content/docs/meta.json"
|
|
77
|
+
{
|
|
78
|
+
"title": "Documentation",
|
|
79
|
+
"root": true,
|
|
80
|
+
"pages": ["index", "getting-started", "---Guides---", "deploy"]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configure the site
|
|
85
|
+
|
|
86
|
+
Use `geistdocs.tsx` to customize the site shell:
|
|
87
|
+
|
|
88
|
+
```tsx title="geistdocs.tsx"
|
|
89
|
+
export const title = "My Documentation";
|
|
90
|
+
|
|
91
|
+
export const nav = [
|
|
92
|
+
{ label: "Docs", href: "/docs" },
|
|
93
|
+
{ label: "GitHub", href: "https://github.com/my-org/my-repo" },
|
|
94
|
+
];
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Read [Configuration](/docs/configuration) for the full configuration surface.
|
|
98
|
+
|
|
99
|
+
## Update Geistdocs
|
|
100
|
+
|
|
101
|
+
For package-based projects, `geistdocs update` updates the `@vercel/geistdocs` package version. It does not overwrite your local content or adapter files.
|
|
102
|
+
|
|
103
|
+
```bash title="Terminal"
|
|
104
|
+
pnpm exec geistdocs update
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Review and test dependency changes before committing.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 概述
|
|
3
|
+
description: 了解 Geistdocs 如何将 CLI、运行时和模板打包为文档站点
|
|
4
|
+
type: overview
|
|
5
|
+
summary: Geistdocs 是一个打包的文档系统,用于创建带共享运行时功能的 Next.js 和 Fumadocs 站点。
|
|
6
|
+
related:
|
|
7
|
+
- /docs/getting-started
|
|
8
|
+
- /docs/configuration
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Geistdocs 是一个基于 Next.js、Fumadocs 和 Vercel 文档模式的打包文档系统。使用它创建一个本地保存内容、运行时由包管理的文档站点。
|
|
12
|
+
|
|
13
|
+
## Geistdocs 的工作方式
|
|
14
|
+
|
|
15
|
+
Geistdocs 由三部分组成:
|
|
16
|
+
|
|
17
|
+
- `@vercel/geistdocs`:提供 CLI、运行时组件、route helpers、MDX 组件、页面操作和打包模板的 npm package。
|
|
18
|
+
- 本地 adapter 文件:生成项目中的文件,用于连接配置、内容 source、路由和 UI 自定义。
|
|
19
|
+
- 平台服务:`geistdocs.com` 上的可选翻译、反馈和 Markdown 请求追踪端点。
|
|
20
|
+
|
|
21
|
+
## 你会编辑的文件
|
|
22
|
+
|
|
23
|
+
大多数项目从这些文件开始:
|
|
24
|
+
|
|
25
|
+
- `content/docs`:编写和组织文档。
|
|
26
|
+
- `content/docs/meta.json`:控制侧边栏顺序和分组。
|
|
27
|
+
- `geistdocs.tsx`:配置 logo、nav、GitHub 仓库、标题、AI prompt、翻译和功能开关。
|
|
28
|
+
- `components/geistdocs/mdx-components.tsx`:添加或覆盖 MDX 组件。
|
|
29
|
+
- `app/[lang]/docs/[[...slug]]/page.tsx`:配置文档页面行为。
|
|
30
|
+
- `proxy.ts`:在包管理的 Markdown 协商前后添加站点特有的请求逻辑。
|
|
31
|
+
|
|
32
|
+
## 包负责的内容
|
|
33
|
+
|
|
34
|
+
包负责文档渲染、页面操作、搜索、Ask AI、Markdown 路由、`llms.txt` 和可复用 MDX 组件等共享行为。更新 `@vercel/geistdocs` 可以获得包级别修复和功能,而不会覆盖你拥有的 adapter 文件。
|
|
35
|
+
|
|
36
|
+
高级项目可以使用包 API 配置版本化文档、多个内容 source、自定义页面 metadata 和自定义 proxy hooks。
|
|
37
|
+
|
|
38
|
+
## 包含的功能
|
|
39
|
+
|
|
40
|
+
- MDX 文档和自定义组件
|
|
41
|
+
- `content/docs` 中的本地内容
|
|
42
|
+
- 搜索和 Ask AI
|
|
43
|
+
- 页面操作,包括反馈、复制页面、在 chat 中打开和在 GitHub 编辑
|
|
44
|
+
- 面向 AI 工具的原始 Markdown 路由
|
|
45
|
+
- `llms.txt`
|
|
46
|
+
- 版本化文档和多个内容 source
|
|
47
|
+
- 用于自定义请求逻辑的 proxy hooks
|
|
48
|
+
- RSS feed
|
|
49
|
+
- 国际化路由
|
|
50
|
+
- init、update 和 translate CLI 命令
|
|
51
|
+
|
|
52
|
+
## 下一步
|
|
53
|
+
|
|
54
|
+
- 阅读 [Getting Started](/docs/getting-started) 创建并运行项目。
|
|
55
|
+
- 阅读 [Configuration](/docs/configuration) 自定义生成的站点。
|
|
56
|
+
- 阅读 [版本化文档](/docs/versioned-docs) 配置多个文档版本。
|
|
57
|
+
- 阅读 [Proxy 和 Markdown 路由](/docs/proxy) 添加自定义请求逻辑。
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: Learn how Geistdocs packages the CLI, runtime, and template for documentation sites
|
|
4
|
+
type: overview
|
|
5
|
+
summary: Geistdocs is a packaged documentation system for creating Next.js and Fumadocs sites with shared runtime features.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/getting-started
|
|
8
|
+
- /docs/configuration
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Geistdocs is a packaged documentation system built with Next.js, Fumadocs, and shared Vercel documentation patterns. Use it to create a docs site with local content files and package-managed runtime features.
|
|
12
|
+
|
|
13
|
+
<CopyPrompt text="Help me understand this Geistdocs project. Explain how the @vercel/geistdocs package, local adapter files, and content/docs folder work together, then suggest the first files I should edit for my documentation site.">
|
|
14
|
+
Help me understand this Geistdocs project. Explain how the `@vercel/geistdocs` package, local adapter files, and `content/docs` folder work together, then suggest the first files I should edit for my documentation site.
|
|
15
|
+
</CopyPrompt>
|
|
16
|
+
|
|
17
|
+
## How Geistdocs works
|
|
18
|
+
|
|
19
|
+
Geistdocs has three main parts:
|
|
20
|
+
|
|
21
|
+
- `@vercel/geistdocs`: The npm package that provides the CLI, runtime components, route helpers, MDX components, page actions, and bundled template.
|
|
22
|
+
- Local adapter files: The files in your generated project that connect your configuration, content source, routes, and UI customization to the package.
|
|
23
|
+
- Platform services: Hosted endpoints at `geistdocs.com` for optional translation, feedback, and markdown tracking features.
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart TB
|
|
27
|
+
subgraph Package["@vercel/geistdocs package"]
|
|
28
|
+
cli["CLI: init, update, translate"]
|
|
29
|
+
runtime["Runtime: layout, routes, MDX, controls"]
|
|
30
|
+
bundledTemplate["Bundled template snapshot"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subgraph Site["Generated docs site"]
|
|
34
|
+
config["geistdocs.tsx"]
|
|
35
|
+
adapters["app/, components/geistdocs/, lib/geistdocs/"]
|
|
36
|
+
content["content/docs/*.mdx"]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
subgraph Platform["Geistdocs platform"]
|
|
40
|
+
translate["/translate"]
|
|
41
|
+
feedback["/feedback"]
|
|
42
|
+
tracking["/md-tracking"]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
cli --> bundledTemplate
|
|
46
|
+
bundledTemplate --> Site
|
|
47
|
+
adapters --> runtime
|
|
48
|
+
content --> adapters
|
|
49
|
+
cli --> translate
|
|
50
|
+
runtime --> feedback
|
|
51
|
+
runtime --> tracking
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## What you edit
|
|
55
|
+
|
|
56
|
+
Most projects start by editing these files:
|
|
57
|
+
|
|
58
|
+
- `content/docs`: Write and organize your docs.
|
|
59
|
+
- `content/docs/meta.json`: Control sidebar order and groups.
|
|
60
|
+
- `geistdocs.tsx`: Configure the logo, nav, GitHub repo, title, AI prompt, translations, and feature flags.
|
|
61
|
+
- `components/geistdocs/mdx-components.tsx`: Add or override MDX components.
|
|
62
|
+
- `app/[lang]/docs/[[...slug]]/page.tsx`: Configure docs page behavior, such as custom render hooks.
|
|
63
|
+
- `proxy.ts`: Add site-specific request logic before or after package-managed markdown negotiation.
|
|
64
|
+
|
|
65
|
+
## What the package owns
|
|
66
|
+
|
|
67
|
+
The package owns shared behavior such as docs rendering, page actions, search, Ask AI, markdown routes, `llms.txt`, and reusable MDX components. Updating `@vercel/geistdocs` gives your project package-level fixes and features without overwriting user-owned adapter files.
|
|
68
|
+
|
|
69
|
+
Advanced projects can use package APIs for versioned docs, multiple content sources, custom page metadata, and custom proxy hooks while keeping runtime behavior in `@vercel/geistdocs`.
|
|
70
|
+
|
|
71
|
+
## Included features
|
|
72
|
+
|
|
73
|
+
- MDX documentation with custom components
|
|
74
|
+
- Local content in `content/docs`
|
|
75
|
+
- Search and Ask AI
|
|
76
|
+
- Page actions, including feedback, copy page, open in chat, and edit on GitHub
|
|
77
|
+
- Raw Markdown routes for AI tools
|
|
78
|
+
- `llms.txt`
|
|
79
|
+
- Versioned docs and multiple content sources
|
|
80
|
+
- Proxy hooks for custom request logic
|
|
81
|
+
- RSS feed
|
|
82
|
+
- Theme-aware images
|
|
83
|
+
- Internationalized routes
|
|
84
|
+
- CLI commands for init, update, and translation
|
|
85
|
+
|
|
86
|
+
## Next steps
|
|
87
|
+
|
|
88
|
+
- Follow [Getting Started](/docs/getting-started) to create and run a project.
|
|
89
|
+
- Read [Configuration](/docs/configuration) to customize the generated site.
|
|
90
|
+
- Read [Versioned docs](/docs/versioned-docs) to configure multiple docs versions.
|
|
91
|
+
- Read [Proxy and markdown routes](/docs/proxy) to add custom request logic.
|
|
92
|
+
- Read [Syntax](/docs/syntax) to write content with MDX components.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 国际化
|
|
3
|
+
description: 为您的文档站点添加多语言支持
|
|
4
|
+
type: guide
|
|
5
|
+
summary: 通过 Geistdocs CLI 和 Fumadocs 路由实现多语言文档自动翻译。
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/getting-started
|
|
8
|
+
related:
|
|
9
|
+
- /docs/configuration
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Geistdocs 支持开箱即用的国际化 (i18n),使用 Fumadocs 的语言感知路由。您可以通过 Geistdocs CLI 提供多语言文档并使用自动翻译。
|
|
13
|
+
|
|
14
|
+
## 工作原理
|
|
15
|
+
|
|
16
|
+
i18n 系统使用带有 `[lang]` URL 段的动态路由。默认语言(英语)不会显示在 URL 中,而其他语言会获得前缀:
|
|
17
|
+
|
|
18
|
+
- `/docs/getting-started` - 英语(默认)
|
|
19
|
+
- `/cn/docs/getting-started` - 中文
|
|
20
|
+
|
|
21
|
+
用户可以使用导航栏中的语言选择器切换语言。
|
|
22
|
+
|
|
23
|
+
## 翻译内容
|
|
24
|
+
|
|
25
|
+
使用 Geistdocs CLI 自动翻译您的 MDX 文件:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @vercel/geistdocs translate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
CLI 会从 `geistdocs.tsx` 中读取目标语言并提示您选择要翻译的文件。
|
|
32
|
+
|
|
33
|
+
翻译由 Geistdocs 平台生成,并与原始文件并存保存在带有区域后缀的文件中(例如,`introduction.cn.mdx`)。
|
|
34
|
+
|
|
35
|
+
### 命令选项
|
|
36
|
+
|
|
37
|
+
您可以直接传递选项以跳过交互式提示:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Translate files using the default glob pattern
|
|
41
|
+
npx @vercel/geistdocs translate
|
|
42
|
+
|
|
43
|
+
# Translate files matching a specific glob pattern
|
|
44
|
+
npx @vercel/geistdocs translate "content/docs/**/*.mdx"
|
|
45
|
+
|
|
46
|
+
# Use a custom config file
|
|
47
|
+
npx @vercel/geistdocs translate "content/**/*.mdx" --config custom-config.tsx
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| 选项 | 描述 |
|
|
51
|
+
| ----------- | ---------------------------------------------------------- |
|
|
52
|
+
| `--config` | 含有翻译配置的配置文件路径(默认:`geistdocs.tsx`) |
|
|
53
|
+
| `--url` | 自定义翻译 API URL |
|
|
54
|
+
|
|
55
|
+
### 批量处理
|
|
56
|
+
|
|
57
|
+
当翻译多个文件时,CLI 会自动将它们分成每组 10 个的批次,以避免速率限制。每个批次完成时都会显示进度。
|
|
58
|
+
|
|
59
|
+
## 配置
|
|
60
|
+
|
|
61
|
+
在 `geistdocs.tsx` 中配置支持的语言:
|
|
62
|
+
|
|
63
|
+
```typescript title="geistdocs.tsx"
|
|
64
|
+
export const translations = {
|
|
65
|
+
en: {
|
|
66
|
+
displayName: "English",
|
|
67
|
+
},
|
|
68
|
+
cn: {
|
|
69
|
+
displayName: "中文",
|
|
70
|
+
search: "搜尋文檔",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`translations` 对象中的第一个区域设置被视为默认/源语言,并且不会作为翻译目标。
|
|
76
|
+
|
|
77
|
+
### 添加新语言
|
|
78
|
+
|
|
79
|
+
添加新语言的步骤:
|
|
80
|
+
|
|
81
|
+
1. 在 `translations` 对象中添加带有语言代码的新键
|
|
82
|
+
2. 为诸如 `displayName` 和 `search` 之类的 UI 元素添加翻译
|
|
83
|
+
3. 运行 `npx @vercel/geistdocs translate "content/**/*.mdx"` 以生成翻译内容
|
|
84
|
+
|
|
85
|
+
语言选择器将自动包含您添加的新语言。
|
|
86
|
+
|
|
87
|
+
## 内容组织
|
|
88
|
+
|
|
89
|
+
翻译后的文件与原始文件并存并带有语言后缀保存:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
content/docs/
|
|
93
|
+
├── getting-started.mdx # English (default)
|
|
94
|
+
├── getting-started.cn.mdx # Chinese
|
|
95
|
+
├── getting-started.fr.mdx # French
|
|
96
|
+
└── getting-started.es.mdx # Spanish
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Fumadocs 会根据 URL 路径自动提供正确的文件。
|
|
100
|
+
|
|
101
|
+
## 翻译 UI 元素
|
|
102
|
+
|
|
103
|
+
`geistdocs.tsx` 中的 `translations` 对象控制诸如搜索占位符、导航标签和错误消息等 UI 文本。为您支持的每种语言添加相应的翻译。
|
|
104
|
+
|
|
105
|
+
如果您没有为某个特定元素提供翻译,则会回退到英语。
|
|
106
|
+
|
|
107
|
+
## 语言检测
|
|
108
|
+
|
|
109
|
+
语言由 URL 路径确定。不根据浏览器设置进行自动检测——用户必须使用语言选择器显式选择他们的语言。
|
|
110
|
+
|
|
111
|
+
这种方法为用户提供了完全的控制,并确保他们看到预期的语言。
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Internationalization
|
|
3
|
+
description: Add multi-language support to your documentation site
|
|
4
|
+
type: guide
|
|
5
|
+
summary: Serve documentation in multiple languages with automatic translation via the Geistdocs CLI and Fumadocs routing.
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/getting-started
|
|
8
|
+
related:
|
|
9
|
+
- /docs/configuration
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Geistdocs supports internationalization (i18n) out of the box using Fumadocs' language-aware routing. You can serve documentation in multiple languages with automatic translation via the Geistdocs CLI.
|
|
13
|
+
|
|
14
|
+
<CopyPrompt text="Help me add a new language to this Geistdocs project. Update translations in geistdocs.tsx, run the Geistdocs translate command for content/docs, and explain how localized routes are generated.">
|
|
15
|
+
Help me add a new language to this Geistdocs project. Update `translations` in `geistdocs.tsx`, run the Geistdocs translate command for `content/docs`, and explain how localized routes are generated.
|
|
16
|
+
</CopyPrompt>
|
|
17
|
+
|
|
18
|
+
## How it works
|
|
19
|
+
|
|
20
|
+
The i18n system uses dynamic routing with a `[lang]` URL segment. The default language (English) doesn't show in URLs, while other languages get a prefix:
|
|
21
|
+
|
|
22
|
+
- `/docs/getting-started` - English (default)
|
|
23
|
+
- `/cn/docs/getting-started` - Chinese
|
|
24
|
+
|
|
25
|
+
Users can switch languages using the language selector in the navigation bar.
|
|
26
|
+
|
|
27
|
+
## Translating Content
|
|
28
|
+
|
|
29
|
+
Use the Geistdocs CLI to automatically translate your MDX files:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm translate
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The CLI reads your target locales from `geistdocs.tsx`. If no locales are found in the config, you'll be prompted to enter them manually.
|
|
36
|
+
|
|
37
|
+
Translations are generated using the Geistdocs platform and saved alongside your original file with the locale suffix (e.g., `introduction.cn.mdx`).
|
|
38
|
+
|
|
39
|
+
### Command Options
|
|
40
|
+
|
|
41
|
+
You can pass options directly to customize the translation behavior:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Translate all MDX files (uses default pattern)
|
|
45
|
+
pnpm translate
|
|
46
|
+
|
|
47
|
+
# Translate files matching a specific glob pattern
|
|
48
|
+
pnpm translate "content/docs/**/*.mdx"
|
|
49
|
+
|
|
50
|
+
# Use a custom config file
|
|
51
|
+
pnpm translate "content/**/*.mdx" --config custom-config.tsx
|
|
52
|
+
|
|
53
|
+
# Use a custom translation API URL
|
|
54
|
+
pnpm translate --url "https://custom-api.example.com/translate"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| Option | Description |
|
|
58
|
+
| ----------- | -------------------------------------------------------- |
|
|
59
|
+
| `--config` | Path to config file with translations (default: `geistdocs.tsx`) |
|
|
60
|
+
| `--url` | Custom translation API URL (can also use `GEISTDOCS_TRANSLATE_URL` env var) |
|
|
61
|
+
|
|
62
|
+
Pass the glob pattern as the command argument. If you omit it, Geistdocs uses `content/docs/**/*.mdx`.
|
|
63
|
+
|
|
64
|
+
The CLI automatically excludes files that already have a locale suffix (e.g., `getting-started.cn.mdx`) to avoid translating already-translated content.
|
|
65
|
+
|
|
66
|
+
### Batch Processing
|
|
67
|
+
|
|
68
|
+
When translating multiple files, the CLI automatically batches them into groups of 10. Progress is displayed as each batch completes, and a 1-second delay is added between batches to avoid rate limiting.
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
Configure supported languages in `geistdocs.tsx`:
|
|
73
|
+
|
|
74
|
+
```typescript title="geistdocs.tsx"
|
|
75
|
+
export const translations = {
|
|
76
|
+
en: {
|
|
77
|
+
displayName: "English",
|
|
78
|
+
},
|
|
79
|
+
cn: {
|
|
80
|
+
displayName: "中文",
|
|
81
|
+
search: "搜尋文檔",
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The first locale in the `translations` object is treated as your default/source language and is excluded from translation targets.
|
|
87
|
+
|
|
88
|
+
### Adding a New Language
|
|
89
|
+
|
|
90
|
+
To add a new language:
|
|
91
|
+
|
|
92
|
+
1. Add a new key to the `translations` object with the language code
|
|
93
|
+
2. Add translations for UI elements like `displayName` and `search`
|
|
94
|
+
3. Run `pnpm translate "content/**/*.mdx"` to generate translated content
|
|
95
|
+
|
|
96
|
+
The language selector will automatically include your new language.
|
|
97
|
+
|
|
98
|
+
## Content Organization
|
|
99
|
+
|
|
100
|
+
Translated files are saved alongside the original with a locale suffix:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
content/docs/
|
|
104
|
+
├── getting-started.mdx # English (default)
|
|
105
|
+
├── getting-started.cn.mdx # Chinese
|
|
106
|
+
├── getting-started.fr.mdx # French
|
|
107
|
+
└── getting-started.es.mdx # Spanish
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Fumadocs automatically serves the correct file based on the URL path.
|
|
111
|
+
|
|
112
|
+
## Translating UI Elements
|
|
113
|
+
|
|
114
|
+
The `translations` object in `geistdocs.tsx` controls UI text like search placeholders, navigation labels, and error messages. Add translations for each language you support.
|
|
115
|
+
|
|
116
|
+
If you don't provide a translation for a specific element, it falls back to English.
|
|
117
|
+
|
|
118
|
+
## Language Detection
|
|
119
|
+
|
|
120
|
+
The language is determined by the URL path. There's no automatic detection based on browser settings - users must explicitly choose their language using the language selector.
|
|
121
|
+
|
|
122
|
+
This approach gives users full control and ensures they see the language they expect.
|