Add content between <head></head> for a plugin

One of the new features for plugins in RapidWeaver 3.6 is the ability to generate header output from a plugin. You do this by declaring the following method in your plugin.

- (NSString *)pageContentHeaders:(NSDictionary *)params;

For example, your plugin has a Javascript file called "myfile.js" that it exports into the "files" folder for a page. To include the Javascript in the header of your generated HTML content, you would do this.

- (NSString *)pageContentHeaders:(NSDictionary *)params
{
    return [NSString stringWithString:@"<script type="text/javascript" src="files/myfile.js"></script>"];
}

Of course, the return value can be generated at run-time if the list of what needs to be included by a page is dynamic.

A really common problem when using this feature is being tripped up by an old RapidWeaver theme that doesn't contain this tag in it's index.html file.

%plugin_header%

If you find yourself trying to work out why the header content still isn't appearing, even after making sure that -pageContentHeaders is being invoked then check the template to make sure that it has a %%plugin_header%% line. This gotcha seems to catch everyone out at least once.