fumadocs-article-importer
npx skills add https://github.com/foreveryh/deeptoai-skills --skill fumadocs-article-importer
Agent 安装分布
Skill 文档
Fumadocs Article Importer
Import external articles into a Fumadocs project with tri-language support (en, zh, fr), auto-classification, and proper MDX formatting.
Prerequisites
- Fumadocs project initialized
- Jina API Key configured (å¿ é)
curlinstalled for article fetch and image downloads- Write access to
content/docs/andpublic/images/
Configuration
Jina API Key é ç½®ï¼å¿ éï¼
Step 1: è·å API Key
- è®¿é® https://jina.ai/reader
- 注å/ç»å½è´¦å·
- å¨ Dashboard çæ API Keyï¼æ ¼å¼ï¼
jina_xxxxxxxxxxxxï¼
Step 2: é ç½®å°ç¯å¢åé
ç¼è¾ ~/.clawdbot/moltbot.jsonï¼
{
"env": {
"JINA_API_KEY": "jina_ä½ çAPI_KEY"
}
}
ææ·»å å° ~/.openclaw/.envï¼
JINA_API_KEY=jina_ä½ çAPI_KEY
Step 3: éªè¯é ç½®
# æµè¯ API å¯ç¨æ§
curl -s "https://r.jina.ai/https://example.com" \
-H "Authorization: Bearer $JINA_API_KEY" | head -20
Workflow
Step 1: Get Article Info
Ask user:
- Article URL
- Target languages (default: en, zh, fr)
- Image strategy (default: auto)
Step 2: Fetch Article Content
ä½¿ç¨ Jina Reader APIï¼curl æ¹å¼ï¼:
# è·åæç« å
容ï¼Markdown æ ¼å¼ï¼
curl -s "https://r.jina.ai/{article_url}" \
-H "Authorization: Bearer ${JINA_API_KEY}" \
-o /tmp/article.md
# æ£æ¥è·åç»æ
if [ ! -s /tmp/article.md ]; then
echo "â æç« è·å失败"
exit 1
fi
echo "â
æç« å
容已è·å"
head -20 /tmp/article.md
æåå¾ç URL:
# ä» Markdown 䏿忿å¾ç URL
grep -oE 'https://[^)]+\.(png|jpg|jpeg|webp|gif)' /tmp/article.md > /tmp/images.txt
# ç»è®¡å¾çæ°é
IMAGE_COUNT=$(wc -l < /tmp/images.txt)
echo "ð åç° ${IMAGE_COUNT} å¼ å¾ç"
å°è¯æåå叿¥æï¼å¯éï¼:
# ä½¿ç¨ Jina çæ¥ææ£æµ API
curl -s "https://r.jina.ai/{article_url}" \
-H "Authorization: Bearer ${JINA_API_KEY}" \
-H "X-With-Generated-Summary: true" \
| grep -oE 'Published:.*|Updated:.*' || echo "æ¥ææªæ¾å°"
Step 3: Generate Slug
Create URL-friendly slug from title:
- Lowercase, hyphens for spaces
- Remove special characters
- Example: “Building Agents with Skills” â
building-agents-with-skills
Step 4: Process Images
å¾çä¸è½½åéå½åï¼éè¦ï¼ï¼:
# å建å¾çç®å½
mkdir -p public/images/docs/{slug}
# ä¸è½½å¾çï¼ä½¿ç¨å®å
¨çæä»¶åï¼
i=1
while IFS= read -r img_url; do
# ä½¿ç¨ img01.png, img02.png æ ¼å¼ï¼é¿å
è¿å符+æ°åï¼
printf -v filename "img%02d.png" $i
echo "ä¸è½½: $img_url â $filename"
curl -s -o "public/images/docs/{slug}/$filename" "$img_url"
# æ´æ° Markdown ä¸çå¾çå¼ç¨
sed -i "s|$img_url|/images/docs/{slug}/$filename|g" /tmp/article.md
((i++))
done < /tmp/images.txt
echo "â
å·²ä¸è½½ $((i-1)) å¼ å¾ç"
å¾çæä»¶åè§åï¼éè¦ï¼ï¼:
â é误ï¼img-1.png, img-10.pngï¼MDX ä¼è§£æ -1, -10 为表达å¼ï¼
â
æ£ç¡®ï¼img01.png, img10.png, openclaw01.pngï¼æ è¿å符ï¼
Step 5: Classify Article
Classify into one of 8 categories (see references/classification-rules.md):
| Category | Description |
|---|---|
development |
Coding, APIs, frameworks |
ai-ml |
AI/ML topics, LLMs |
tools |
Developer tools, CLIs |
best-practices |
Patterns, methodologies |
architecture |
System design, infrastructure |
testing |
Testing, QA |
security |
Security practices |
general |
Everything else |
Step 6: Create MDX Files
For each language, create MDX file:
English: content/docs/en/{category}/{slug}.mdx
Chinese: content/docs/zh/{category}/{slug}.mdx
French: content/docs/fr/{category}/{slug}.mdx
Frontmatter template (see assets/frontmatter-template.yaml):
---
title: {translated_title}
description: {translated_description}
author: {original_author}
date: {publication_date}
lang: {en|zh|fr}
category: {category}
---
Step 7: Translate Content
Use article-translator skill to translate:
- Title and description
- Article body (preserving code blocks, MDX syntax)
- Image alt text
Key rules:
- Keep code blocks unchanged
- Preserve MDX component syntax
- Add space after
**bold**in Chinese/Korean
Step 8: Update Navigation
Update content/docs/{lang}/meta.json:
{
"title": "{Category Title}",
"pages": ["existing-page", "{new-slug}"]
}
See references/meta-json-best-practices.md for details.
Step 9: Generate Illustration (Optional)
Use philosophical-illustrator skill to create cover image:
Generate an 800x450px SVG illustration for: {article_title}
Theme: {category}
Save to: public/images/docs/{slug}/cover.svg
Step 10: Validate and Report
- Verify all files created correctly
- Check MDX syntax compiles
- Verify image paths resolve
- Report summary to user
Output Structure
content/docs/
âââ en/{category}/{slug}.mdx
âââ zh/{category}/{slug}.mdx
âââ fr/{category}/{slug}.mdx
public/images/docs/{slug}/
âââ image1.png
âââ image2.png
âââ cover.svg (optional)
Error Handling
| Error | Solution |
|---|---|
| No images extracted | Verify withAllImages: true was used |
| CORS failure | Switch to download strategy |
| Translation failed | Check article-translator skill is available |
| Slug conflict | Append date suffix: {slug}-2024-01-15 |
References
references/classification-rules.md– Category classification rulesreferences/fumadocs-components.md– Available MDX componentsreferences/meta-json-best-practices.md– Navigation configurationreferences/jina-mcp-setup.md– Jina MCP configurationassets/frontmatter-template.yaml– Frontmatter template