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:
- Acquire a
.wxr file
, and place it in the folderapp/config/extensions/importwxr
. - In the Bolt backend, go to 'Import WXR'.
- Follow the steps on screen.
- 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. - 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.yml
configuration
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
andbody
need to be present in yourpages
andentries
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