Coder Social home page Coder Social logo

thezedwards / wordpress-exporter.rb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from contentful/wordpress-exporter.rb

0.0 1.0 0.0 53 KB

Adapter to extract data from Wordpress

Home Page: https://www.contentful.com

License: MIT License

Ruby 100.00%

wordpress-exporter.rb's Introduction

Wordpress to Contentful Exporter

Note: This tool is no longer officially supported as of May 11th, 2017. You can feel free to use it, fork it and patch it for your own needs. Downloads from RubyGems will still be available.

Description

This adapter will allow you to extract content from a WordPress Blog and prepare it to be imported to Contentful.

The following content will be extracted:

  • Blog with posts
  • Categories, tags and terms from custom taxonomies
  • Attachments

Installation

gem install wordpress-exporter

This will install the wordpress-exporter executable on your system.

Setup

To extract the blog content you need to export it from the WordPress blog and save it as a XML file.

Further you need to define where the tool can find the XML file and the destination of the transformed content. Create a settings.yml file and fill in the data_dir and wordpress_xml_path:

data_dir: PATH_TO_ALL_DATA
wordpress_xml_path: PATH_TO_XML/file.xml

To extract the content run:

wordpress-exporter --config-file settings.yml --extract-to-json

The result will be a directory structure with the WordPress content transformed into JSON files that are ready for import.

Use the generic-importer to import your blog then to Contentful.

Step by step

  1. Export the content of the blog from WordPress and save it as XML file.

  2. Create YAML file with settings (eg. settings.yml) and fill in the required parameters. The generated content types, entries and assets will be saved to the data_dir. We recommend you to use wordpress_settings/wordpress_settings.yml file in this repository

  3. Extract the content from the XML file and generate the content model and JSON files for the import:

    wordpress-exporter --config-file settings.yml --extract-to-json

    If you want to create a different content model for your blog you can use --omit-content-model

    wordpress-exporter --config-file settings.yml --extract-to-json --omit-content-model

    It will only extract the content and store it as JSON, you need to take care about the content mapping yourself. See the Contentful-importer for details on how this needs to be done.

  4. (Optional). HTML markup can be converted to markdown:

    wordpress-exporter --config-file settings.yml --convert-markup

    This will only touch the content body of a blog post, other attributes will not be changed.

  5. Create your content model from JSON:

    wordpress-exporter --config-file settings.yml  --create-contentful-model-from-json
    
  6. Use the contentful-importer to import the content to contentful.com

  7. Add you organization id and the access token to your settings.yml

  8. Add the new created space id to your settings.yml file.

  9. Now follow the steps (starting from step 3) of our contentful-importer guide to publish your content.

wordpress-exporter.rb's People

Contributors

dlitvakb avatar pxlpnk avatar neonichu avatar erikreedstrom avatar

Watchers

James Cloos 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.