<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>WordPress on Luca's Blog</title><link>https://wlj.me/tags/wordpress/</link><description>Recent content in WordPress on Luca's Blog</description><generator>Hugo</generator><language>zh</language><lastBuildDate>Tue, 14 Apr 2026 20:44:10 +0800</lastBuildDate><atom:link href="https://wlj.me/tags/wordpress/index.xml" rel="self" type="application/rss+xml"/><item><title>把父亲的 WordPress.com 博客迁到 Hugo + Cloudflare Pages</title><link>https://wlj.me/posts/wuwufu-wordpress-to-hugo/</link><pubDate>Tue, 14 Apr 2026 20:44:10 +0800</pubDate><guid>https://wlj.me/posts/wuwufu-wordpress-to-hugo/</guid><description>&lt;p>父亲从 2005 年开始在 WordPress.com 写博客，到 2025 年一共 786 篇文章、591 条评论、78 段视频。这几天把它整站搬到了 Hugo + Cloudflare Pages，托管在 &lt;a href="https://wuwufu.com">wuwufu.com&lt;/a>。&lt;/p>
&lt;p>记录一下工具链和几个要留意的地方。&lt;/p>
&lt;h2 id="整体方案">整体方案&lt;/h2>
&lt;ul>
&lt;li>内容：wp2hugo 从 WordPress 导出的 WXR XML 转 Markdown&lt;/li>
&lt;li>主题：PaperMod，自定义布局模仿原站 Twenty Seventeen 的头图风格&lt;/li>
&lt;li>评论：REST API 抓回来，生成静态 HTML 嵌入每篇文章末尾&lt;/li>
&lt;li>视频：ffmpeg x265 2-pass 压缩，从 10.1GB 压到 587MB&lt;/li>
&lt;li>托管：Cloudflare Pages，DNS 也搬到 Cloudflare&lt;/li>
&lt;/ul>
&lt;h2 id="内容转换wp2hugo">内容转换：wp2hugo&lt;/h2>
&lt;p>WordPress 后台导出 WXR XML（Tools → Export），然后跑 &lt;a href="https://github.com/ashishb/wp2hugo">wp2hugo&lt;/a>，出来就是 Hugo 友好的目录结构：&lt;code>content/posts/*.md&lt;/code> + &lt;code>static/wp-content/uploads/&lt;/code>。&lt;/p>
&lt;p>转换后 Markdown 里会有一些残留的 WordPress shortcode（&lt;code>[gallery]&lt;/code>、&lt;code>[embed]&lt;/code> 这些），还有空标题、重复文章，写了几个清理脚本扫一遍。&lt;/p>
&lt;h2 id="评论自己抓嵌进去">评论：自己抓，嵌进去&lt;/h2>
&lt;p>WordPress.com 因为不是自托管，用不了评论迁移插件。但 20 年下来 591 条评论不能丢。&lt;/p>
&lt;p>好在 WordPress.com 开放了 REST API，按文章 ID 翻页抓：&lt;/p></description></item></channel></rss>