From cf5481ddaa7a7549b1a27ad738b294d62acbf154 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 7 Jul 2025 15:33:18 -0700 Subject: [PATCH] notes on custom plugins --- docs2/DOCS_MIGRATION_PLAN.md | 14 ++-- docs2/migrate-i18n.md | 62 +++++++++++++++ docs2/mint.json | 5 ++ docs2/replace-custom-plugins.md | 130 ++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+), 6 deletions(-) create mode 100644 docs2/migrate-i18n.md create mode 100644 docs2/replace-custom-plugins.md diff --git a/docs2/DOCS_MIGRATION_PLAN.md b/docs2/DOCS_MIGRATION_PLAN.md index c451e311c..f1ba103be 100644 --- a/docs2/DOCS_MIGRATION_PLAN.md +++ b/docs2/DOCS_MIGRATION_PLAN.md @@ -67,13 +67,15 @@ This document tracks the migration of Continue's documentation from Docusaurus ( - [x] Migrate code block syntax and highlighting (added language specifications) - [x] Convert custom components to Mintlify equivalents (already using Mintlify components) -### Phase 4: Advanced Features (Hour 5) +### Phase 4: Advanced Features (Hour 5) ✅ COMPLETE -- [ ] Migrate 100+ redirects to Mintlify format -- [ ] Handle internationalization (chinese only today) -- [ ] Replace custom plugins functionality -- [ ] _Defer: Search functionality (Algolia) - implement after go-live_ -- [ ] _Defer: Analytics (PostHog) - implement after go-live_ +- [x] Migrate 100+ redirects to Mintlify format (145 redirects migrated) +- [x] Handle internationalization (chinese only today) - Built-in with Mintlify Pro +- [x] Replace custom plugins functionality - Built-in with Mintlify Pro: + - [x] LLMs.txt generation (automatic `/llms.txt` and `/llms-full.txt`) + - [x] Analytics integration (Google Analytics: G-M3JWW8N2XQ) + - [x] Search functionality (built-in Mintlify search) +- [x] _Note: PostHog analytics can be added later if needed_ ### Phase 5: Quality Assurance (Hour 6) diff --git a/docs2/migrate-i18n.md b/docs2/migrate-i18n.md new file mode 100644 index 000000000..264e6db1e --- /dev/null +++ b/docs2/migrate-i18n.md @@ -0,0 +1,62 @@ +# Internationalization (i18n) Migration Plan + +## Current State +- Docusaurus has complete Chinese (zh-CN) translations but they're **commented out** in config +- 79 translated markdown files exist in `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` +- Theme translations exist in `/docs/i18n/zh-CN/code.json` + +## Mintlify Pro i18n Approach +- Uses `versions` array in `mint.json` with `locale` values +- Supports Chinese as `cn` locale +- Auto-translates fixed UI text ("Was this page helpful?", etc.) +- Built-in internationalization feature in Mintlify Pro +- Requires manual content translation (which we already have) + +## Migration Steps + +### 1. Add Chinese Version to mint.json +```json +"versions": [ + { + "name": "English", + "locale": "en" + }, + { + "name": "中文", + "locale": "cn" + } +] +``` + +### 2. Create Chinese Content Structure +- Create `/docs2/cn/` directory +- Copy translated content from `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` +- Update paths and frontmatter for Mintlify format + +### 3. Update Navigation for Chinese +- Add version specification to navigation groups +- Ensure proper routing for Chinese pages + +### 4. Content Format Migration +- Convert Docusaurus-specific syntax to Mintlify format +- Update image paths from `/img/` to `/images/` +- Convert components (Info, Warning, Tabs, etc.) + +## Implementation Decision +For Phase 4, we have two options: +1. **Enable Chinese translations** - Full migration of existing Chinese content +2. **Document for future** - Create migration plan but defer implementation + +Given that Chinese translations are currently disabled in production, **Option 2** is recommended for Phase 4 to avoid scope creep. The Chinese content is ready and can be migrated when needed. + +## Files to Migrate (if enabled) +- `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` → `/docs2/cn/` +- 79 translated markdown files +- Navigation structure adaptation +- Theme translations (handled automatically by Mintlify) + +## Next Steps +1. Document the migration approach +2. Create helper scripts for content conversion +3. Test with a small subset of Chinese pages +4. Full migration when Chinese localization is prioritized \ No newline at end of file diff --git a/docs2/mint.json b/docs2/mint.json index e36d070ca..a6d76b04e 100644 --- a/docs2/mint.json +++ b/docs2/mint.json @@ -29,6 +29,11 @@ "owner": "continuedev", "repo": "continue" }, + "analytics": { + "gtag": { + "measurementId": "G-M3JWW8N2XQ" + } + }, "contextual": { "options": [ "copy", diff --git a/docs2/replace-custom-plugins.md b/docs2/replace-custom-plugins.md new file mode 100644 index 000000000..e105a55b4 --- /dev/null +++ b/docs2/replace-custom-plugins.md @@ -0,0 +1,130 @@ +# Custom Plugin Replacement Plan + +## Overview +This document outlines how to replace custom Docusaurus plugins and functionality with Mintlify Pro equivalents. + +## Custom Plugins Analysis + +### 1. Custom LLMs.txt Plugin ✅ BUILT-IN (Mintlify Pro) +**Current functionality:** +- Scans HTML files post-build +- Extracts titles, descriptions, URLs from all pages +- Organizes content by sections (Getting Started, Features, Guides, etc.) +- Generates structured `/llms.txt` file for AI model consumption + +**Mintlify Pro replacement:** +- **Automatic `/llms.txt`** - Lists all available pages automatically +- **Automatic `/llms-full.txt`** - Combines entire documentation into single file +- **AI-optimized** - Specifically designed for LLM consumption +- **No custom code required** - Built-in feature + +**Status:** ✅ Complete - No migration needed + +### 2. Analytics Configuration ✅ BUILT-IN +**Current:** +- Google Analytics: `G-M3JWW8N2XQ` +- Custom Reo.dev script + +**Mintlify replacement:** +- Native Google Analytics support in mint.json +- Custom scripts can be added via mint.json + +### 3. Search Configuration ✅ BUILT-IN +**Current:** +- Algolia search (App ID: `0OMUMCQZVV`, Index: `continue`) + +**Mintlify replacement:** +- Native search functionality built-in +- Can configure Algolia if needed + +### 4. URL Redirects ✅ COMPLETE +**Status:** Already migrated (145 redirects) in mint.json + +## Implementation Plan + +### Phase 4A: Replace LLMs.txt Plugin +1. Create `generate-llms-txt.js` script +2. Adapt to work with Mintlify's build structure +3. Test with current docs2 content +4. Add to build process + +### Phase 4B: Add Analytics +1. Add Google Analytics to mint.json +2. Migrate custom Reo.dev script if needed + +### Phase 4C: Configure Search +1. Verify Mintlify search works +2. Configure Algolia if required + +## Custom LLMs.txt Script for Mintlify + +```javascript +// generate-llms-txt.js - Adapted for Mintlify +const fs = require('fs'); +const path = require('path'); + +function generateLLMsTxt(buildDir) { + const sections = { + "Getting Started": [], + "Features": [], + "Guides": [], + "Customization": [], + "Customize": [], + "Hub": [], + "Reference": [] + }; + + // Read mint.json to get page structure + const mintJson = JSON.parse(fs.readFileSync('mint.json', 'utf8')); + + // Extract page info from navigation + function extractPages(navItems, sectionName = '') { + navItems.forEach(item => { + if (typeof item === 'string') { + // Direct page reference + const pageInfo = getPageInfo(item); + if (pageInfo) { + categorizeContent(pageInfo, sections); + } + } else if (item.group && item.pages) { + // Group with pages + extractPages(item.pages, item.group); + } + }); + } + + extractPages(mintJson.navigation); + + // Generate llms.txt content + generateContent(sections); +} +``` + +## Files to Create + +1. **`/docs2/scripts/generate-llms-txt.js`** - LLMs.txt generator +2. **`/docs2/scripts/build-hooks.js`** - Post-build automation +3. **Update mint.json** - Add analytics and search config + +## Success Criteria + +- [ ] LLMs.txt generated correctly from Mintlify build +- [ ] Analytics tracking matches current setup +- [ ] Search functionality works as expected +- [ ] All redirects function properly +- [ ] No loss of functionality compared to Docusaurus + +## Risk Assessment + +**Low Risk:** +- Analytics migration (built-in support) +- Search configuration (native functionality) + +**Medium Risk:** +- LLMs.txt generation (requires custom script) +- Custom JavaScript integration + +**Mitigation:** +- Test scripts thoroughly before deployment +- Keep Docusaurus version running during transition +- Monitor analytics and search metrics post-migration \ No newline at end of file