Monthly Archives: July 2011

Converting a static website into a wordpress website

I was recently working on a project that required me to convert a static HTML based website into a wordpress site. After finishing the layout and the theme work, I was facing the task of manual copy paste labor. Determined not to waste my time, I was looking around for solutions that crawled a static website and output HTML pages. Tried my hand at Python using BeautifulSoup but it didn’t go anywhere meaningful.

After some fiddling around I found this plugin for wordpress, called HTML Import 2 that lets you import content from static html files. All I had to do now was to create those static HTML pages. As I was searching, I found a beautiful solution that required no additional software on my Ubuntu.

wget. I was astonished at what this command could do, for I have always used it for only downloading a single link.

wget -r –level=0 –convert-links –page-requisites –no-parent  <url> downloads all pages in the site, forms the directories for images and other javascript, etc as in the original site and you have a perfect copy of the site locally. Some extension renaming, and twiddling around later, I had the converted wordpress site ready.