If you want to transfer your existing TWiki webs to Google Sites, you can do it automatically with the power of the Google Sites API and Perl.
You can download the Perl script, which I used to export my TWiki webs and then import them in Google Sites, at the following page: http://www.famzah.net/download/google-api/twiki2googlesites.pl
Note that this is in no way a complete migration solution. You can use it as a demonstration/base on how to interact with the following Google API features using Perl:
- Google Data APIs in general.
- ClientLogin authentication and authorization.
- Google Sites Data API – Retrieving content, Creating new pages, and Creating subpages.
Now you know that you can use Perl to interact with Google APIs. Go build your own scripts!
Update: Google released Python command line tools for the Google Data APIs (GoogleCL). They seem promising and very easy to use for simple automation tasks.
P.S. If you’re limited on time and your TWiki is relatively small on pages count, you’ve got a pretty good chance of migrating it manually with copy/paste, than writing your own migration scripts. Believe me. 🙂
May 31, 2010 at 1:33 am
that is very cool!
Someone might be interested at some stage to package this code up into PublishPlugin – for http://foswiki.org of course 🙂
And so in the interests of those that come after, is there any chance that you would add an explicit license for this code (GPL?).
Cheers and Beers
Sven
June 1, 2010 at 9:56 am
Sure, I’ve added a GPL license. The weakest point of the script is the render_wiki_to_html() function. If someone implements it right, I could be of help with the other stuff like communicating with the Google API.
July 12, 2013 at 1:58 pm
I realize this is an amateur doubt but no one seems to be able to help, so here goes:
I would like to know if the “wiki-data” has to be within my system or whether a remote TWiki would also suffice. I’ve got the code to run and linked it to my Google Site but nothing happens. Any pointers would be highly appreciated
July 13, 2013 at 8:40 am
You either have to run the script from the server hosting your TWiki site, or copy all TWiki files in the folder pointed by $wikidata. This folder contains all your TWiki webs and pages in the following format:
$wikidata/$web/$page.txt
Furthermore, you need to edit the variable @webs_to_import accordingly. If Google Sites don’t accept some of your web names (I forgot what the policy is), you may need to edit camelcase2dashes() too.
As a start, first uncomment the two create_page() examples in main(), which will create two sample pages in your Google Sites. The “print Dumper(get_created_pages())” statement will try to read those pages back using the Google API. Once you are sure that the script is interacting properly with the Google Sites API, continue debugging what’s happening locally when analyzing your existing TWiki file structure.
July 17, 2013 at 1:49 pm
Thank you. However, on a slightly different note, I’ve managed to get the html code of the twiki using perl. Would it be possible for me to directly add that page into my Google Sites (via the HTML box)? Or would some modification of the create_Page() allow me to do that?
July 18, 2013 at 9:07 am
I’m not an expert on Google Sites, but this seems doable, yes. You can copy/paste the HTML source directly. The Perl script does pretty much the same.
July 17, 2013 at 2:07 pm
I wish to take a bunch of TWikis and be able to place them under a page titled “TWikis” in my Google Site and not actually migrate the entire TWiki. Will a modification of your code allow me to do that?
July 18, 2013 at 9:08 am
You can do that, but I can’t code it for you, sorry. This Perl script was provided as an example proof-of-concept. I can’t support it nor develop it any further.
July 18, 2013 at 10:14 am
heya,
just in case you do want help coding up a solution – email me at sven@fosiki.com – we might be able to work something out 🙂
Sven