wp2hugo
1.11.0
这是将 WordPress 导出迁移到 Hugo 的最佳迁移器。它处理了我在尝试将我的个人网站迁移到基于 Hugo 的网站时遇到的几个奇怪的边缘情况。
虽然这主要针对基于 Hugo 的代码生成,但可以使用它将 WordPress 博客转换为基于 Markdown 的文件,这些文件可以与其他系统(例如 Mkdocs 或 Jekyll)一起使用。
我希望这个项目能够尽可能广泛地开放,同时仍然为开发成本提供资金。该项目完全免费,可供非商业和个人使用。商业用途通过许可证受到限制。如果您想获得商业许可,请随时与我联系。
wp2hugo
工具Tools -> Export
导出您的 WordPress 网站wordpress-export.xml
使用$ wp2hugo --source wordpress-export.xml --download-media
生成网站$ wp2hugo
Usage of wp2hugo:
-authors string
CSV list of author name(s), if provided, only posts by these authors will be processed
-color-log-output
enable colored log output, set false to structured JSON log (default true)
-continue-on-media-download-error
continue processing even if one or more media downloads fail
-download-media
download media files embedded in the WordPress content
-font string
custom font for the output website (default " Lexend " )
-media-cache-dir string
dir path to cache the downloaded media files (default " /tmp/wp2hugo-cache " )
-output string
dir path to write the Hugo-generated data to (default " /tmp " )
-source string
file path to the source WordPress XML file
$ git clone [email protected]:ashishb/wp2hugo.git
$ cd wp2hugo/src/wp2hugo
$ make build_prod
# `./bin/wp2hugo` will contain the binary and you can use it as `$ ./bin/wp2hugo --source wordpress-export.xml --download-media`
wp2hugo
的目标feed.xml
映射到 Hugo 的 RSS feed.xml
Summary
googlemaps
迁移 Google 地图嵌入wp-content/uploads
图像迁移到 Hugo 静态文件,同时维护相对 URL 现有工具在迁移内容方面做得并不成熟。他们很少正确迁移 GUID、YouTube 嵌入、Google 地图嵌入和代码嵌入等元数据。
该存储库包含一个实验工具hugomanager
。我使用此工具根据标题自动生成 URL,并了解哪些博客文章仍标记为草稿或哪些博客文章计划很快发布。
你可以通过构建它
src/wp2hugo $ make build_hugo_manager
...
src/wp2hugo $ ./bin/hugomanager
A tool for managing Hugo sites e.g. adding URL suggestions, generating site status summary etc.
Usage:
hugomanager [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
sitesummary Print site stats (e.g. number of posts, number of drafts etc.)
urlsuggest Suggests URLs for all the pending/future posts that are missing a URL
version Print the version number of HugoManager
Flags:
-a, --author string author name for copyright attribution (default " YOUR NAME " )
--config string config file (default is $HOME /.cobra.yaml)
-h, --help help for hugomanager
-l, --license string name of license for the project
--viper use Viper for configuration (default true)
Use " hugomanager [command] --help " for more information about a command.
笔记: