The Personal Blog of Stephen Sekula

Migrate your COREBlog to WordPress

I thought there might be some Zope folks out there who would find the following useful. Below is the code for my DTML method, wordpress_xml, that converts COREBlog posts to WordPress XML. If you want to export your entire blog to WordPress, make sure to change the visible days’ worth of posts in the settings to a large number. Just put this DTML method in the top level of your blog’s Zope contents folder:

<dtml-comment>
##############################################################################
wordpress_xml

Generates WordPress XML, for exporting COREBlog to WordPress

Copyright (c) 2007 Steve Sekula

##############################################################################
</dtml-comment>
<dtml-call “RESPONSE.setHeader(‘content-type’, ‘text/xml’)”><?xml version=”1.0″ encoding=”<dtml-var management_page_charset>” ?><rss version=”2.0″ xmlns:content=”http://purl.org/rss/1.0/modules/content/” xmlns:wfw=”http://wellformedweb.org/CommentAPI/” xmlns:dc=”http://purl.org/dc/elements/1.1/” xmlns:wp=”http://wordpress.org/export/1.0/”>

<channel>
<title><dtml-var title></title>
<link><dtml-var blogurl></link>
<description><dtml-var blog_description></description>
<pubDate>
<dtml-in “rev_day_entry_items(count=1)” size=1>
<dtml-var “date_created().toZone(‘UTC’).strftime(‘%Y-%m-%dT%H:%M:%SZ’)”>
</dtml-in>
</pubDate>
<generator>http://wordpress.org/?v=2.2.3</generator>
<language>en</language>
<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:posts_private>0</wp:posts_private><wp:links_private>0</wp:links_private><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>blogroll</wp:category_nicename><wp:category_parent></wp:category_parent><wp:posts_private>0</wp:posts_private><wp:links_private>0</wp:links_private><wp:cat_name><![CDATA[Blogroll]]></wp:cat_name></wp:category>

<dtml-in “rev_day_entry_items(count=top_days)”>

<item>
<title><dtml-var title></title>
<link><dtml-var blogurl>/<dtml-var id></link>
<pubDate><dtml-var “date_created().toZone(‘UTC’).strftime(‘%Y-%m-%dT%H:%M:%SZ’)”></pubDate>
<dc:creator><dtml-var author html_quote></dc:creator>
<dtml-in entry_category_list>
<category><![CDATA[<dtml-var name>]]></category>
</dtml-in>

<guid isPermaLink=”false”><dtml-var blogurl>/<dtml-var id></guid>
<description></description>
<content:encoded><![CDATA[<dtml-var body newline_to_br>]]></content:encoded>
<wp:post_id><dtml-var id></wp:post_id>
<wp:post_date><dtml-var “date_created().toZone(‘UTC’).strftime(‘%Y-%m-%dT%H:%M:%SZ’)”></wp:post_date>
<wp:post_date_gmt><dtml-var “date_created().toZone(‘GMT’).strftime(‘%Y-%m-%dT%H:%M:%SZ’)”></wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>test</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:postmeta>
<wp:meta_key>_encloseme</wp:meta_key>
<wp:meta_value>1</wp:meta_value>
</wp:postmeta>
</item>
</dtml-in>
</channel>
</rss>

2 thoughts on “Migrate your COREBlog to WordPress”

Comments are closed.