3 ms·
I just had to do a similar thing with the HashBackup web site. It was hosted on Google Sites for about 10 years, but Google came out with Sites v2 last year an
by prirun 5y ago
I just had to do a similar thing with the HashBackup web site. It was hosted on Google Sites for about 10 years, but Google came out with Sites v2 last year and everyone had to convert by Sep 2021. Of course I ignored it too long, Sep came along, and Google froze the HashBackup site, forcing me to convert to v2.
Okay, so I did a preview migration. The new site looked terrible. They lost all kinds of formatting, the menus were confusing - I couldn't figure them out myself! I sent several notes to Google's "Report a problem with the conversion" link, but never heard anything from them. Publishing the v2 site was a non-starter.
The HashBackup site is nowhere near this scale. I got a dump from Google Sites in a zip file that was about 20MB and included all of Google's JavaScript. I could have hosted it somewhere like that, but the HTML was sort of a mess. Sites lets you edit content by highlighting it and clicking Bold or whatever. But the problem is, if you change the font of some text then go back later and extend it, it's easy for the text fragments to become disjoint, so the resulting HTML doesn't look anything like what a person would write. So while it would have worked for a while to edit existing pages, there's no way I could have added or deleted a page.
I ended up using Antora, on recommendations from a recent HN topic, mainly because I liked the professional look of it. Static generators like Hugo tend to have lots of themes, but many of them look amateurish to me. Antora uses Asciidoc for content, which was my goal when Sites v2 was announced: get the site in some kind of markdown.
To do the conversion to Asciidoc, I started out doing some hand editing to get familiar with the kinds of HTML Google Sites generated. There are a lot of variations. Once I started seeing some patterns, I wrote a Python script to handle some of the conversions. So the loop was:
1. Run Python script on all html files to convert to adoc
2. Pick an adoc file to review. I did this from smallest file to largest, so that by the time I got to the larger files, more of the conversion would be automated.
3. Review the adoc file, see what trash was still there that might be easily fixed in the Python script; make changes to the script, re-run it. Loop in this step until the easy automated stuff is done.
4. Finish editing the adoc file by hand, run antora to generate the site, review the new page using the old page as a reference if necessary.
5. Once the new adoc file looks right, delete the .html file. This step is very important to prevent the automatic converter from overwriting your new adoc file. I did this more than once of course, but it was still in an Emacs buffer so I was okay.
I never got the converter to the point where it would work 100%, but it did maybe 80% of the tedious editing and allowed me to focus on what was left. And it was a lot easier to see some erroneous HTML in an adoc text file than it was to try to edit a verbose HTML file that Sites created.
Here's the script I used. It's a big ugly hack, but maybe it will help somebody.
http://www.hashbackup.com/gstoad.py http://www.hashbackup.com/gstoad.py
I'm really happy with the new HashBackup site, and the best part is, it's now just 1MB of Asciidoc text that will be easy to maintain. It took about 2 weeks to do the conversion, adjust the Antora UI layout, and adjust the links.