create-blog-post-from-url

celery94's avatarfrom celery94

从给定 URL 抽取信息并生成新的博客 Markdown 文章、资源目录和 frontmatter。

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 23, 2025

When & Why to Use This Skill

This Claude skill automates the end-to-end workflow of transforming web-based articles into professionally structured technical blog posts. It leverages web scraping to extract core content, performs high-quality English-to-Chinese translation, manages local image assets, and generates Markdown files with SEO-optimized frontmatter and consistent metadata, significantly accelerating the content curation and documentation process.

Use Cases

  • Technical Content Localization: Automatically convert English technical documentation or industry news into localized Chinese blog posts, ensuring accurate terminology and natural phrasing.
  • Efficient Knowledge Base Construction: Rapidly populate a Markdown-based knowledge repository by extracting structured data, summaries, and key takeaways from multiple web sources.
  • Streamlined Blogging Workflow: Simplify the creation of technical blogs by automating repetitive tasks such as slug generation, image resource management, and frontmatter formatting from a single URL input.
namecreate-blog-post-from-url
description从给定 URL 抽取信息并生成新的博客 Markdown 文章、资源目录和 frontmatter。

当用户提供一个文章 URL 并要求创建博客时,按以下流程执行。

输入

  • 必需: 原文 URL
  • 可选: 指定标题、发布日期、标签、是否需要图片

1. 收集信息

  • 使用 playwright/web 打开 URL,获取标题、作者/来源、发布日期、主旨摘要、章节结构。
  • 只保留与主题相关的关键段落,避免整段无差别搬运。
  • 若需要配图,优先选择文中主图或关键示意图并下载到本地。

2. 翻译内容

  • 必须将原文翻译为中文,包括标题、描述和正文内容。
  • 保持技术术语的准确性,专有名词可保留英文并附中文说明。
  • 翻译需流畅自然,符合中文技术写作习惯。
  • 代码示例保持原样,但注释需翻译为中文。

3. 生成 ID 与 Slug

  • 在 src/data/blog 中读取已有文件名,解析 {ID}- 数字前缀并递增。
  • 将 ID 保持为 3 位数字(例如 095 -> 096)。
  • Slug 使用 kebab-case;如果标题为中文,转成简短英文/拼音短语并保持唯一。

4. 处理图片资源

  • 创建 src/assets/{ID}/ 目录保存图片资源。
  • 图片文件名使用 kebab-case,例如 clean-architecture-diagram.png。
  • 在 Markdown 中使用相对路径引用: ../../assets/{ID}/image-name.png
  • 为每张图片提供简洁、具体的中文 alt 文本。

5. 生成 Markdown 文件

  • 文件路径: src/data/blog/{ID}-{slug}.md
  • 使用以下 frontmatter 模板并填充中文内容:
---
pubDatetime: YYYY-MM-DD
title: "文章标题(中文)"
description: "80-160 字中文摘要,概括文章核心观点"
tags: ["Tag1", "Tag2"]
slug: "{slug}"
source: "{original_url}"
---
# {中文标题}

## 背景

## 关键要点

## 实践建议

6. 质量检查

  • 确认所有内容均为中文,技术术语翻译准确。
  • 说明文字清晰、段落结构合理,避免冗长。
  • tags 保持 2-6 个,包含技术主题(如 .NET, Azure, Architecture)。
  • source 必须指向原始 URL。
  • 文章中图片路径与目录保持一致。