All Projects → bolt → ImportWXR

bolt / ImportWXR

Licence: MIT License
[Bolt Extension] An Import filter for WXR files, as created by Wordpress or PivotX

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

ImportWXR extension

This Bolt Extension is an Import filter for WXR / XML files, as created by Wordpress or PivotX.

How to use this extension, in a few simple steps:

  1. Acquire a .wxr file, and place it in the folder app/config/extensions/importwxr.
  2. In the Bolt backend, go to 'Import WXR'.
  3. Follow the steps on screen.
  4. Tweak the configuration file, if needed. It can be found at app/config/extensions/importwxr.bolt.yml, or using the 'Configure Extensions' option in the backend of Bolt.
  5. Repeat until satisfied with the results.

Note: After importing, scroll down to check if the script completed. If categories were found in the .wxr-file, the script will tell you which should be added to your taxonomy.yml-file.

If you're importing a .wxr file that was generated by a recent version of Wordpress, the 'mapping' as defined in the importwxr.bolt.ymlconfiguration should be good as-is. You might need to make a few modifications to your contenttypes.yml, to make sure all fields are present. See the example below, for a working example.

If you already have set up your own contenttypes, just make sure of the following:

  • The fields teaser and body need to be present in your pages and entries contenttypes.
  • Make sure the taxonomy is present, otherwise the extension will not import your existing categories and tags.
  • Add the attachments contenttype, if you want to import the attachments from Wordpress.

Note: Subsequent runs of the extension will keep importing the found posts/entries again and again. If you're working on a fresh Bolt database, it's probably good to set post_id: id in the mapping configuration. This will make the importer use the original ID from the import file, and it will overwrite them, preventing duplicates in the Bolt database.


Example of contenttypes.yml, if importing from Wordpress:

pages:
    name: Pages
    singular_name: Page
    fields:
        title:
            type: text
            class: large
            group: content
        slug:
            type: slug
            uses: title
        image:
            type: image
        teaser:
            type: html
            height: 150px
        body:
            type: html
            height: 300px
        template:
            type: templateselect
            filter: '*.twig'
    taxonomy: [ categories, chapters ]
    recordsperpage: 100


entries:
    name: Entries
    singular_name: Entry
    fields:
        title:
            type: text
            class: large
            group: content
        slug:
            type: slug
            uses: title
        teaser:
            type: html
            height: 150px
        body:
            type: html
            height: 300px
        image:
            type: image
            group: media
        video:
            type: video
    taxonomy: [ categories, tags ]
    recordsperpage: 10

attachments:
    name: Attachments
    singular_name: Attachment
    fields:
        title:
            type: text
            class: large
        slug:
            type: slug
            uses: title
        image:
            type: image
        body:
            type: html
            height: 300px
        url:
            type: text
            variant: inline
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].