Fixing Ghost scrambled IDs after importing data

I’ve written a plug-in that exports data from Pelican to Ghost in JSON format. After writing the plug-in I realized that Ghost has a few quirks of its own and that is that if updated_at field is NULL the behavior in the admin panel gets a bit freaky.

This is why I came up with this small script. All it does is sort in ascending manner the posts and update the updated_at field with the value in created_at.