How to Import Wordpress Blogs into Liferay Blogs
This is a howto for importing data from a wordpress blog into Liferay's Blog#
1) Export the data from wordpress#
- Login as an admin
- Click Manage tab
- Click Export subtab
- Specify "Restrict Author"
- Click "Download Export File"
- Save the export file on your Desktop
- Rename (or copy) the export file as 'wordpress.xml'. (Since you may be modifying the file in the next step, it's recommended that you make a copy and backup the originial.)
2) Validate the XML of the export file#
- The export file's XML may not be well formed. Make sure to validate and correct any errors such that the XML is well formed.
Common errors are:
- undefined XML entities (convert those to their decimal format).
- bare '&' within non-CDATA text (convert to &)
3) Create a 'Wordpress to Liferay' user map file#
- The export file will contain references to it's users as
<dc:creator>user_name</dc:creator>
- Create a file called 'wordpress-user-map.xml' with the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<wordpress-user-map> <wordpress-user email-address="test@liferay.com" >user_name</wordpress-user> </wordpress-user-map> }}}
- Create a 'wordpress-user' element for each mapped user, specifying the email address of a Liferay account as the value of 'email-address'. Matching posts will be mapped to the Liferay account with that email address.
- Any posts referencing unmapped accounts or for accounts which cannot be resolved, even by the mapping, will be linked with the user account performing the "Import".
- All comments will be inserted as if created by the default user. This allows preserving the comment_author field value.
4) Create a Portlet LAR file from a Blog portlet in the Portal.#
- Login as a admin
- Locate/Place a "Blogs" portlet in the target Community/Org
- Click the "Configuration" icon
- Click the "Export/Import" tab
- From the "Export" tab, click "Export"
- Save the file on your Desktop
5) Insert the export file and user map file into the Blog Portlet LAR#
- Extract the Portlet LAR to some folder.
- Place the 'wordpress.xml' and 'wordpress-user-map.xml' you created in eariler steps into the folder of the LAR at the following path:
<EXTRACTED_LAR_ROOT>/groups/####/portlets/33/
- Zip up the extracted folder structure, making sure that the exact structure is retained. Withing the zip file, the paths should remain
/groups/####/portlets/33/wordpress.xml /groups/####/portlets/33/wordpress-user-map.xml
- Rename the new zip file with .lar
6) Import the Portlet LAR into the Blog portlet#
- Login as a admin
- Locate/Place a "Blogs" portlet in the target Community/Org
- Click the "Configuration" icon
- Click the "Export/Import" tab
- From the "Import" tab, click "Browse" to locate the .lar file you just created
- Optionally, click "Delete portlet data before importing." if that is required (this might be useful if you've previously tried to import the LAR but it failed because of the XML of the import file was not well formed.)
- Click "Import"
7998 Views