Code Monkey home page Code Monkey logo

hexo-migrator-wordpress's Introduction

hexo-migrator-wordpress

Build Status NPM version

Migrate your blog from WordPress to Hexo.

Install

In your blog folder, add this npm dependencie to your project:

$ npm install hexo-migrator-wordpress --save

Usage

Export your WordPress in "Tools" โ†’ "Export" โ†’ "All Content" in your dashboard.

Execute the following command after installed. source is the file path or URL of WordPress export file.

$ hexo migrate wordpress <source> [--options]
  • alias: Populates the alias setting in the front-matter, for use with the hexo-generator-alias module. This is useful for generating redirects.
  • limit: Maximum number of posts to import from the input file. All posts are imported by default.
    • Example:
    $ hexo migrate wordpress /path/export.xml --limit 3
    • This doesn't apply to pages, all pages will be imported.
  • skipduplicate: Skip posts with similar title as existing ones.
    • If the input contains a post titled 'Foo Bar' and there is an existing post named 'Foo-Bar.md', then that post will not be migrated.
    • The comparison is case-insensitive; a post titled 'FOO BAR' will be skipped if 'foo-bar.md' exists.
    • Without this option (default), this plugin will continue to migrate that post and create a post named 'Foo-Bar-1.md'
  • import-image: Download all image attachments from your Wordpress.
    • Downloaded images will be saved based on the original directories.
      • Example: http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg => source/2020/07/image.jpg => http://yourhexo.com/2020/07/image.jpg.
      • Image embed link will be automatically replaced with a new path.
        • Example: ![title](http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg) => ![title](/2020/07/image.jpg)
    • If post_asset_folder is enabled before migration, images will be saved according to their associated post.
      • Example: http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg is associated with http://yourwordpress.com/2020/07/04/foo-post/ post.
      • http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg => source/_posts/foo-post/image.jpg => http://yourhexo.com/2020/07/04/foo-post/image.jpg.
      • Image embed link will be automatically replaced with a new path.
        • Example: ![title](http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg) => ![title](image.jpg)
      • Note that the images are only valid when viewing individual post, not in index page. If you prefer to have them viewable on the index page too and you are using hexo-renderer-marked 3.1.0+, enables the postAsset: option.
    • Limited to JPEG, PNG, GIF and WebP images only.
    • This also applies to resized images.
      • Example: http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg => source/2020/07/image-500x300.jpg => http://yourhexo.com/2020/07/image-500x300.jpg.
      • Compatible with post_asset_folder: http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg => source/_posts/foo-post/image-500x300.jpg => http://yourhexo.com/2020/07/04/foo-post/image-500x300.jpg.
    • Usage: $ hexo migrate wordpress /path/export.xml --import_image
    • original: Download original image attachments only.
      • Resized image embed will be replaced with original-sized image.
      • Example: http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg => source/2020/07/image.jpg => http://yourhexo.com/2020/07/image.jpg.
      • Usage: $ hexo migrate wordpress /path/export.xml --import_image original
  • paragraph-fix: If you used Wordpress classic editor to write posts, you may find imported posts do not have the original paragraphs. Use this option to restore the paragraphs.
  • default-category: Set a default category for posts without any category.
    • Usage: $ hexo migrate wordpress /path/export.xml --default-category 'unknown'
    • Defaults to the value set in user configuration:
    # _config.yml
    default_category: uncategorized

hexo-migrator-wordpress's People

Contributors

aetherwu avatar arthurlacoste avatar bebraw avatar chrisyip avatar curbengh avatar dengshilong avatar dependabot-preview[bot] avatar dorayo avatar gboudreau avatar hrwhisper avatar jashsayani avatar jjgod avatar jlhwung avatar joshstrange avatar opengg avatar ryanhanwu avatar sunnybingome avatar tomap avatar tommy351 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.