pebble blog-> ghost cms
Intro
I was using for quite a while pebble. At that time for some (security?) reason I move there from Wordpress and wanted a blog in the java-world. Strangely I can/couldn't find appealing java-blogging-projects.. (I'm sure there are)
To make a long story short. Due to performance issues I switch again and this time to ghost-cms. It looks very appealing has a good editor and the default-theme is already good enough for me. Now the question, how do I migrate the content from pebble to ghost? ghost already have some importers but obviously none for pebble. But it has a good description how to format data for ghost able to import data.
Let's get fingers dirty
I took the way to export my data via pebble's rss export.
Login as admin in pebble
Utilities > Export utilities > Export Blog (choose the RSS-Option)
This will result in a huge-xml file with the whole textual content of your blog. Looking like this:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>Tom's Blog</title>
<link>http://thomas.trocha.com:80/pebble/</link>
<description/>
<language>en</language>
<copyright>dertom</copyright>
<pubDate>Sun, 02 Aug 2020 17:08:00 GMT</pubDate>
<dc:creator>dertom</dc:creator>
<dc:date>2020-08-02T17:08:00Z</dc:date>
<dc:language>en</dc:language>
<dc:rights>dertom</dc:rights>
<item>
<title>Working via remote</title>
<link>http://thomas.trocha.com:80/pebble/working-via-remote</link>
<category domain="http://thomas.trocha.com:80/pebble/tags/linuxy OS of choice is linux I needed a good alternative for linux.</p>
....
Now we need to convert this to a json-format that ghost do understand. The docs are quite good about it and I wrote a python-script that can:
- import pebble-rss (at least mine)
- try to download images (jpg,png,gif) (only absolute urls) to images subfolder and rewrites urls
- export ghost-compatible css
What it does not:
- export static pages (those are not included in the rss)
- I guess lots of things... 😉
- preserve image-names. names are renamed to image-xxxx.[png|jpg|gif]
- It does not have a CLI-Interface. You will need to alter some(4) variables
input_name = 'pebble_blog_rss_orig.xml' output_name = 'blog.json' download_images = True image_folder = 'images'
Get the script here:
Edit the script to fit you filenames
Then run it:
python convert_rss2ghost.py
If(!) every went well you will have:
- the exported json-file
- an images folder
copy the images in to you ghost's content/images folder (yes, resulting in content/images/images )
Then go to your ghost-admin-console:
Hit browse, select the json-file and import.
If(!) everything went well. Your pebble-blog is now imported.