wjs-converting-wp-to-hugo
Use when migrating a WordPress site to a Hugo static site on GitHub Pages from a WXR export (.xml) plus the wp-content/uploads folder — preserving /archives/<id>/ URLs, localizing images, and deploying via GitHub Actions. Triggers — "把 WordPress 迁成 Hugo", "wordpress 转静态站", "migrate WordPress to Hugo", "WXR to Hugo", "publish WordPress to GitHub Pages", "/wjs-converting-wp-to-hugo".
npx skills add jianshuo/claude-skills --skill wjs-converting-wp-to-hugo --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# wjs-converting-wp-to-hugo 把任意 WordPress 站迁成 **Hugo + Markdown + git** 静态站,部署到 **GitHub Pages**。 输入只需两样,**全程离线、零第三方依赖**: 1. **WXR 导出** — WordPress 后台 `工具 → 导出 → 所有内容` 得到的 `*.xml`(包含全部文章/页面/分类/标签的 HTML 正文)。 2. **`uploads/` 文件夹** — 站点的 `wp-content/uploads/`(按 `年/月` 分目录的图片与附件)。 产出:`content/*.md` + `static/wp-content/uploads/` + 手写极简主题,Hugo 构建,GitHub Actions 发布。 **全站 URL 保持 `/archives/<数字>/` 不变,老链接 100% 不断。** ## When to use - 用户有一个 WordPress 站,想去掉动态/评论/数据库,改成 git + Markdown 维护。 - 用户提供了 WXR `.xml` 和 `uploads/`(或能拿到)。 - 老链接必须保留(SEO / 外部引用)。 ## When NOT to use - 没有 WXR,只有线上站 → 先在 WP 后台导出,或用 REST API 拉 JSON(本 skill 走 WXR,更可移植)。 - 要保留评论/会员/搜索等动态功能 → 静态站做不了,不适用。 - 站点极小(几篇)→ 手抄更快。 ## Core principle **WXR 是唯一真相源,`uploads/` 直接当静态资源。** 图片不下载、不改名:把 `uploads/` 拷进 `static/wp-content/uploads/`,正文里的图片 URL 改成 **根相对** `/wp-content/uploads/...` 即可原地解析。文章 URL 从 `<link>` 原样保留。转换器是**纯函数 + 单元测试**,先测后写。 ## Pipeline ``` WXR .xml + uploads/ → wxr_to_hugo.py → content/*.md + static/wp-content/uploads/ → hugo build → GitHub Actions → Pages ``` ## Two decisions you MUST ask the user (do not silently decide) WordPress 里有两类内容静态站处理不了,**必须问用户**,别擅自发布: 1. **密码保护文章**(`<wp:post_password>` 非空)。静态站无密码门 → 发布就是公开。 选项:**排除*
- When to use
- When NOT to use
- Core principle
- Pipeline
- Two decisions you MUST ask the user (do not silently decide)
- Steps
- 1. 放好输入,建工程
- 2. 先跑测试(转换器是 TDD 的)
- 3. 确认计数 + 跑全量转换
- 4. 构建并断言所有老链接命中
- 5. 本地肉眼核对
- 6. 推到 GitHub(公开仓库见「安全」)
- 7. 开 Pages → Actions,先开后跑
- 8. DNS 切换(操作者手动,验证通过后再做)
mkdir -p ~/code/<site> && cd ~/code/<site> && git init cp /path/to/<site>.WordPress.*.xml . uploads/ 放到工程根(含子目录 年/月)。注意它可能含 wordpress_db.sql —— 勿提交! cp -R /path/to/uploads ./uploads mkdir -p scripts tests content/posts layouts/_default layouts/partials static cp "$SK"/scripts/*.py scripts/ # wxr_to_hugo.py, verify_build.py cp "$SK"/tests/test_wxr.py tests/ # 单元测试(须放 tests/,与 scripts/ 同级) cp -R "$SK"/assets/layouts/. layouts/ # 手写主题 cp "$SK"/assets/hugo.toml . # 改 title / baseURL / 菜单 mkdir -p .github/workflows && cp "$SK"/assets/workflow-hugo.yml .github/workflows/hugo.yml
What does the wjs-converting-wp-to-hugo skill do?
Use when migrating a WordPress site to a Hugo static site on GitHub Pages from a WXR export (.xml) plus the wp-content/uploads folder — preserving /archives/<id>/ URLs, localizing images, and deploying via GitHub Actions. Triggers — "把 WordPress 迁成 Hugo", "wordpress 转静态站", "migrate WordPress to Hugo", "WXR to Hugo", "publish WordPress to GitHub Pages", "/wjs-converting-wp-to-hugo".
How do I install it?
Run `npx skills add jianshuo/claude-skills --skill wjs-converting-wp-to-hugo --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From jianshuo/claude-skills, a repository with 112 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
