Hey,
Trying to use this module with subsites highlighted for us that the API was unclear, and the legacy baggage didn't really help.
We have gone back to the board and thought that objects actually have two distinct behaviours:
- some of them want to be publishable (generating HTML files)
- some of them want to trigger publishing of others (have dependencies)
Objects can be publishable by providing the urlsToCache method - they get to define the URLs they wish to "own" (implementing StaticallyPublishable). This explicitly establishes the object responsible for a specific URL and makes it easy to generate the full cache - just find everything that is StaticallyPublishable, and ask for URLs. Also because URLs have always some associated objects, it's possible to use the ORM to find out the context - such as "which subsite does this URL belong to" or "does this URL belong to an ErrorPage"?
On the other hand objects can request updates of some group of objects (not URLs!) by providing objectsToDelete and objectsToUpdate methods (implementing StaticPublishingTrigger). It's up to the specific implementation to decide when to ask for this information though - it's like the object was simply saying "In some general sense, I have dependencies on these other guys, and when I change, I'm likely to impact them".
We are providing the following basic implementation for the SiteTree use case:
- PublishableSiteTree which implements both interfaces for your most usual use case - a hierarchical, publishable page.
- PublishableRedirectorPage which partly replaces the above to make sure it's own link is used as the URL (not the redirect target)
Then we have some concrete engines that consume these:
- SiteTreePublishingEngine that keeps the SiteTree objects updated as pages are published and unpublished (consumes both interfaces)
- SiteTreeFullBuildEngine which republishes the entire tree (consumes only the publishable one)
Publishing is working now with subsites, and also the engine can generate error pages with names you can rely upon (error-<code>.html). I haven't tested this without subsites, VirtualPages probably won't work yet, and deletions are not hooked up for subsites. Also there is no other implementations apart from the one that couples with the SiteTree, so if you want to associate an URL with a Controller, you'd need to write your own implementation and engine for it :-) Ah yeah, and the queue implementation could get a refresh so we don't have to smuggle ID/ClassName in the URL...
Now, I wonder if this all works with Translatable <succumbs into mad laughter>
If you want to help - you know where to find the code :-)
m