[WordPress] 外掛分享: WP Gatsby Markdown Exporter

首頁外掛目錄 › WP Gatsby Markdown Exporter
100+
安裝啟用
★★★★★
5/5 分(2 則評價)
2254 天前
最後更新
問題解決
WordPress 4.6+ PHP 5.6+ v0.3.3 上架:2020-01-05

內容簡介

這個外掛可以建立包含已轉換為 Markdown 格式的文章的 zip 檔案。此外,還可以使用 WP-CLI 命令進行網站的大量內容匯出。其他的功能包括:

- 將 WordPress 內容轉換為 Gatsby 友好的 Markdown。
- 自訂匯出!可以重新映射和重組匯出的欄位。
- CLI:使用 WP-CLI 進行命令行操作,避免 PHP 超時問題。
- CLI:匯出進度條(非常適用於大型網站)!

提醒:匯出內容前,請務必備份 WordPress 的資料庫和檔案,以防匯出不如預期。

與 Gatsby 合作:

如果您剛開始使用 Gatsby,建議嘗試使用基於 Markdown 的 Gatsby 起始器,如 Tina Grande。安裝過程非常簡單,只要複製匯出的 WordPress Markdown 到 content 目錄,或者將 wp gatsby-markdown-export 命令指向 content 目錄即可。

如果您想將 WordPress 或 HTML 主題移植到 Gatsby,可以查看 "Porting an HTML Site to Gatsby" 以獲取更多提示。

命令行使用:

命令行功能使用 WP-CLI 與 WordPress 進行交互。如果您尚未安裝 WP-CLI,可以輕鬆安裝。

安裝完成後,可以像這樣將內容匯出到目錄:

wp gatsby-markdown-export --directory=/example/gatsby-starter/src/content

所有命令行參數均為可選。詳細的參數說明如下:

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.3.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP Gatsby Markdown Exporter」→ 直接安裝(推薦)

原文外掛簡介

The plugin creates zip files containing posts converted to Markdown. A WP-CLI command exists to handle exporting sites with a large amount of content.

Move WordPress content to Gatsby-friendly Markdown.
Customize the export! Remap and restructure exported fields.
CLI: Avoid PHP timeouts by using the command line with WP-CLI.
CLI: Export progress bar (great for large sites)!

Reminder: always keep a backup of the WordPress database and files in case your export doesn’t work as expected!

Working with Gatsby
If you’re just getting started with Gatsby, we recommend experimenting with a Markdown based Gatsby starter like Tina Grande. Installation is as easy as:
git clone https://github.com/tinacms/tina-starter-grande.git

cd tina-starter-grande

yarn install && gatsby develop

Then copy your exported WordPress Markdown into the content directory or point the wp gatsby-markdown-export command at the content directory.
Want to port your WordPress or HTML theme to Gatsby? Checkout Porting an HTML Site to Gatsby for tips.
Command Line Usage
The command line functionality uses WP-CLI to interact with WordPress. WP-CLI is easy to install if you haven’t already.
Once it’s installed, you can export content to a directory like this:
wp gatsby-markdown-export --directory=/example/gatsby-starter/src/content

All CLI arguments are optional.
Option
Description
Default value
--help
get help
--directory=
export output directory
random temp directory
--post_types=
post types to export, see: https://developer.wordpress.org/reference/classes/wp_query/#post-type-parameters
page,post
--post_status=
post status to export, see: https://developer.wordpress.org/reference/classes/wp_query/#status-parameters
any
--fields_to_markdown=
fields to convert to Markdown
excerpt
--excluded_front_matter=
fields to exclude from front matter
--post_date_format=
format for post publish date, see: https://www.php.net/manual/en/function.date.php
c
--upload_dir=
directory in the export to copy WordPress uploads
uploads
--remap_fields=
remap front matter field names, example: find1,replace1;find2,replace2
--fields_to_array=
convert single value front matter fields to arrays
--include_private_fields=
private post meta fields to include (they start with _)
--skip_copy_uploads
flag, skips copying WordPress uploads to the export
--skip_original_images
flag, skips the use of original dimension images
--skip_enforce_charset
flag, skips use of blog_charset for the XML charset
--create_type_directory
flag, creates directories based on post type

延伸相關外掛

文章
Filter
Apply Filters
Mastodon