In my previous post about caching, I wrote that the content-rewrite feature was not available in the PHP version of Shindig, but it turns out it was already implemented as of version 1.0.x.

Although the content-rewrite feature was proposed in OpenSocial 0.9, it seems it can also be used in 0.8 and 0.7.

Here is how to use it:

<Optional feature="content-rewrite">
  <Param name="expires">86400</Param>
  <Param name="include-url"></Param>
  <Param name="exclude-url">excluded</Param>
  <Param name="exclude-url">moreexcluded</Param>
  <Param name="minify-css">true</Param>
  <Param name="minify-js">true</Param>
  <Param name="minify-html">true</Param>
</Optional>
  • expires: Specifies the cache expiration time in seconds. The default is 86400 seconds (24 hours).
  • include-url: Specifies the URLs of external content you want to cache. Asterisks ("*") can be used. Specifying something like ".gif" assumes asterisks before and after. Can be repeated.
  • exclude-url: Specifies the URLs of external content you do not want to cache. Handled the same way as include-url.
  • minify-css: Specifies whether to minify CSS files before caching with "true" or "false". The default is "true".
  • minify-js: Specifies whether to minify JS files before caching with "true" or "false". The default is "true".
  • minify-html: Specifies whether to minify HTML files before caching with "true" or "false". The default is "true".

exclude-url takes precedence over include-url. "*" matches all URLs. Specific behavior depends on the container.

This should make development a bit easier.