Migrating Articles from Liferay to Medium

Importing existing posts to Medium isn’t easy. Medium supports importing blogs from Wordpress, but nothing more. As I don’t have thousands of entries, I could, of course, do it manually, but then all the posts would be dated for today. The service desk at Medium provides a service where they backdate your posts, but that feels like too much human intervention for a nerd like me ;-)

From Liferay you can get pretty much all important content via RSS feed. It leaves out two of my oldest posts, but I could live without those. The WordPress export format is pretty close to RSS, I read from the interwebs, but Medium doesn’t seem to support it directly — I tried. I could have probably written a simple XSLT transformation for the format, but the got another idea to try out. I have used WordPress before for some hobby projects, and even though I don’t like most of what I have seen, I like the fact that it has a plugin for everything. And it also has a plugin to import content from XML files like RSS feeds. My idea was to import entries first to a local WordPress and from there export to Medium.

This is how I did it.

Step 1, get WordPress

The de-facto method for today’s developers to prepare an environment for tools WordPress is Docker. Even if you aren’t familiar with Docker, you can still get WordPress up and running with Docker pretty fast:

Step 2, Use the Import XML feed plugin

The built-in import-export functionality in WP also claims to support importing from RSS feeds. Still, it didn’t work with the version that Liferay creates. Thus, I installed a plugin called “Import XML feed”. After you have installed that, you’ll find the tool in the Settings view. The usage is pretty straightforward.

The only nasty thing is, that Liferay puts line endings to the (entity encoded) HTML presentation found in the summary tag (which BTW contains the whole blog entry). The importer then decides to put line ends to <p>n</p> and double line ends into <p>nn</p>. My solution was to download the RSS feed and-and use text editor to replace all line ends with spaces. The nasty thing with this is that code snippets in <pre> tags also lose their line endings, but was ready to take that hit and spent a couple of minutes manually formatting them via Medium.

Once you have your articles in WordPress, you can use the export feature and pass that to the import feature in Medium. That works pretty well after that.


So, importing articles from Liferay to Medium is possible, but not straightforward. For my case with just around 20 articles, it didn’t require any coding or modifying Liferay settings, but for a larger set of articles, you’ll probably need to finetune this recipe bit further. Got some ideas how to make this happen easier? Share your ideas below.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.