Movable Type

额外依赖项

此导入器需要以下额外库文件。

可以通过运行 gem install GEM_NAME 分别安装所需的 gem,或者使用下面这条命令一次性全部安装: gem install mysql2 pg safe_yaml sequel sqlite3

调用方式

调用导入器的示例命令:

jekyll-import mt --dbname DB --user USER --engine ENGINE --password PW --host HOST --port PORT --blog_id ID --categories --src_encoding ENCODING --dest_encoding ENCODING --comments
选项 <PARAM> 说明
--dbname DB

Database name.

--user USER

Database user name.

--engine ENGINE

Database engine (‘mysql’ or ‘postgres’).

默认值:  'mysql'
--password PW

Database user’s password.

默认值:  ''
--host HOST

Database host name.

默认值:  'localhost'
--port PORT

Custom database port connect to.

默认值:  null
--blog_id ID

Specify a single Movable Type blog ID to import.

默认值:  null (all blogs)
--categories

When true, save post’s categories in its YAML front matter.

默认值:  true
--src_encoding ENCODING

Encoding of strings from database.

默认值:  UTF-8
--dest_encoding ENCODING

Encoding of output strings.

默认值:  UTF-8
--comments

When true, output comments in _comments directory.

默认值:  false

*上方表格中高亮的行表示必填选项。

comments(默认为 false)用于控制是否生成评论内容。如果将 comments 设置为 true,评论会被生成并放入 _comments 目录中。

所有的文章和评论都会在 YAML front matter 中包含 post_id,用于将文章与其评论关联起来。

如果希望将导入的评论作为文章的一部分显示,可以使用尚未合并的 mt-static-comments fork,通过该方式在文章中静态生成评论内容。如有需要,可以自行 fork 并提供反馈。

查看源码 →