StaticPublisher works very well, but the typical implementation only produces the caching of the main SiteTree.
example: http://www.sandrobilbeisi.net/ssx244/
on a website with multiple languages, only the default (English) language is cached, whilst the other languages are not.
I've tried hacking around both the standard implementation (described at : http://doc.silverstripe.org/staticpublisher) and an alternative.
I cannot seem to figure out how to access the translated pages for inclusion in the cache array.
/**
* Return a list of every page that could be cached
*/
function allPagesToCache() {
$urls = array();
$pages = DataObject::get("Page");
foreach($pages as $page) {
$urls[] = $page->Link();
}
return $urls;
}
OR
/**
*Return a list of all the pages to cache
*/
function allPagesToCache() {
// Get each page type to define its sub-urls
$urls = array();
// memory intensive depending on number of pages
$pages = DataObject::get("SiteTree");
//print_r($pages);
foreach($pages as $page) {
$urls = array_merge($urls, (array)$page->subPagesToCache());
}
// add any custom URLs which are not SiteTree instances
$urls[] = "sitemap.xml";
return $urls;
}
/**
* Get a list of URLs to cache related to this page
*/
function subPagesToCache() {
$urls = array();
// add current page
$urls[] = $this->Link();
// cache the RSS feed if comments are enabled
if ($this->ProvideComments) {
$urls[] = Director::absoluteBaseURL() . "pagecomment/rss/" . $this->ID;
}
return $urls;
}
cheers,
Sandro Bilbeisi