コード例 #1
0
 public function index($request)
 {
     $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
     $this->getResponse()->addHeader('X-Robots-Tag', 'noindex');
     $entries = GoogleSiteMapGenerator::getInstance()->Entries();
     return array('Entries' => $entries);
 }
コード例 #2
0
 public function testGetEntries()
 {
     GoogleSiteMapGenerator::getInstance()->registerDataObject($class_name = 'SiteTree', $change_freq = GoogleSitemapGenerator::CHANGE_FREQ_MONTHLY, $priority = GoogleSitemapGenerator::PRIORITY_1_0, $get_url_function = function ($page) {
         $url = $page->AbsoluteLink();
         return $url;
     });
     GoogleSiteMapGenerator::getInstance()->registerDataObject($class_name = 'PublicCloudService', $change_freq = GoogleSitemapGenerator::CHANGE_FREQ_MONTHLY, $priority = GoogleSitemapGenerator::PRIORITY_1_0, $get_url_function = function (IPublicCloudService $public_cloud) {
         $company_name = $public_cloud->getCompany()->getName();
         $slug = $public_cloud->getSlug();
         $url = sprintf('/marketplace/public-clouds/%s/%s', $company_name, $slug);
         $url = Director::absoluteURL($url);
         return $url;
     });
     $list = GoogleSiteMapGenerator::getInstance()->Entries();
     $this->assertTrue(count($list) > 0);
 }
コード例 #3
0
ファイル: _config.php プロジェクト: rbowen/openstack-org
    $featured_news = $news_repository->getFeaturedNews();
    $recent_news = $news_repository->getRecentNews();
    $slide_news = $news_repository->getSlideNews();
    return array_merge($featured_news, $recent_news, $slide_news);
});
GoogleSiteMapGenerator::getInstance()->registerDataObject($class_name = 'FeaturedVideo', $change_freq = GoogleSitemapGenerator::CHANGE_FREQ_MONTHLY, $priority = GoogleSitemapGenerator::PRIORITY_0_5, $get_url_function = function ($video) {
    $page = PresentationCategoryPage::get()->filter('ID', $video->PresentationCategoryPageID)->first();
    if (!$page) {
        return false;
    }
    $page_url = $page->Link('featured');
    $url = sprintf('%s/%s', $page_url, $video->URLSegment);
    $url = Director::absoluteURL($url);
    return $url;
}, function () {
    $videos = DataObject::get('FeaturedVideo', '`YouTubeID` IS NOT NULL');
    return $videos;
});
GoogleSiteMapGenerator::getInstance()->registerDataObject($class_name = 'Presentation', $change_freq = GoogleSitemapGenerator::CHANGE_FREQ_MONTHLY, $priority = GoogleSitemapGenerator::PRIORITY_0_5, $get_url_function = function ($video) {
    $page = PresentationCategoryPage::get()->filter('ID', $video->PresentationCategoryPageID)->first();
    if (!$page) {
        return false;
    }
    $page_url = $page->Link('presentation');
    $url = sprintf('%s/%s', $page_url, $video->URLSegment);
    $url = Director::absoluteURL($url);
    return $url;
}, function () {
    $videos = DataObject::get('Presentation', '`YouTubeID` IS NOT NULL', 'StartTime DESC');
    return $videos;
});