Loading...
Loading...
Import external articles into a Fumadocs project with automatic multi-language translation (en, zh, fr), AI-powered classification into 8 categories, image processing, and MDX conversion. Use this skill when the user wants to import an article from a URL into their Fumadocs documentation site.
npx skill4agent add foreveryh/deeptoai-skills fumadocs-article-importercurlcontent/docs/public/images/jina_xxxxxxxxxxxx~/.clawdbot/moltbot.json{
"env": {
"JINA_API_KEY": "jina_你的API_KEY"
}
}~/.openclaw/.envJINA_API_KEY=jina_你的API_KEY# 测试 API 可用性
curl -s "https://r.jina.ai/https://example.com" \
-H "Authorization: Bearer $JINA_API_KEY" | head -20# 获取文章内容(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# 从 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 "日期未找到"building-agents-with-skills# 创建图片目录
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(无连字符)references/classification-rules.md| Category | Description |
|---|---|
| Coding, APIs, frameworks |
| AI/ML topics, LLMs |
| Developer tools, CLIs |
| Patterns, methodologies |
| System design, infrastructure |
| Testing, QA |
| Security practices |
| Everything else |
content/docs/en/{category}/{slug}.mdxcontent/docs/zh/{category}/{slug}.mdxcontent/docs/fr/{category}/{slug}.mdxassets/frontmatter-template.yaml---
title: {translated_title}
description: {translated_description}
author: {original_author}
date: {publication_date}
lang: {en|zh|fr}
category: {category}
---**bold**content/docs/{lang}/meta.json{
"title": "{Category Title}",
"pages": ["existing-page", "{new-slug}"]
}references/meta-json-best-practices.mdGenerate an 800x450px SVG illustration for: {article_title}
Theme: {category}public/images/docs/{slug}/cover.svgcontent/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 | Solution |
|---|---|
| No images extracted | Verify |
| CORS failure | Switch to download strategy |
| Translation failed | Check article-translator skill is available |
| Slug conflict | Append date suffix: |
references/classification-rules.mdreferences/fumadocs-components.mdreferences/meta-json-best-practices.mdreferences/jina-mcp-setup.mdassets/frontmatter-template.yaml