Advanced RapidWeaver: edit your page template code.
I'm using RapidWeaver to author this site, and I was wondering whether it was at all possible to add specific code to all pages of the site. Why would you want to do that, one might ask. Well maybe you want to add javascript code to incorporate tracking statistics, or use snap.com for page previews. RapidWeaver has limited code editing capabilities: it either lets you author a page from scratch in HTML, or you can use the Page Inspector (Window > Page Inspector), with which you can edit the page prefix, add custom CSS styles, or custom javascript code that will end up in the header.
If those options are not enough, all is not lost. Here's what to do:

  1. Create your own theme: if you make any mistake, you don't want to alter the themes that ship with RapidWeaver, so make your own. So click the Toggle Themes View button (left of the Publish button on the lower right of the window), right-click on your current theme and select Duplicate Theme.

  2. Select this new theme and right-click again to select Show Contents. This will open in the Finder the location where RapidWeaver stores all the files that make up your new theme. The file we want to edit is index.html, it is the template RapidWeaver uses for all your site pages. Open it in your favorite text editor and make the required changes. In my case I added the javascript code at the start of the body section for statcounter to track this site's page stats.

  3. Save the file, look in the Code view of RapidWeaver to double-check your changes were incorporated at the right place, save and publish your changes.


That's it, you are now an official RapidWeaver power user.
|