The Times They Are A-Changin'
The ol' web site just got a fairly substantial makeover. It's been a long time coming, considering the previous layout was still using framesets (gasp!) to keep from duplicating the banner and sidebar code on every page.
This time around I decided I'd get with the times and make each page stand on its own. Not wanting to manage duplicated banner and sidebar code in each page, I needed a way to keep all the layout code in one file and effectively import it into each page. I'm sure the cool kids have HTML editors that do this or they use server-side includes. I went with static code generation using ERb (Embedded Ruby). The top of each page includes the following code snippet:
<%= File.read('layout.html') %>
Then I just run a script that filters all the HTML files through the erb tool before uploading them to the web server. So far it's working pretty darn well. If you notice any browser gotchas, or you have advice for making it look and feel better, I'd appreciate hearing about it.
Dave reminded me that I could have used the handy layout support in Rails. There's nothing dynamic on my site, so Rails may be overkill, but with page caching enabled it becomes moot. Just spider the site with curl, for example, when anything changes and visitors get all the performance of a static site. I may ultimately move that direction, but it felt like too many moving parts to manage for just a couple of static pages. Famous last words.
One more thing: I've also decided to officially hang out a Rails shingle. We're still heads-down on our current Rails project for a client, but I've so enjoyed the whole Rails experience with James, and the client is equally happy, that I'd like to take on other Rails projects in the future. As well, it looks like Dave and I will start offering Rails Training this fall. So I'm deep in Rails right now, and looking forward to much more to come.