protected function generateSiteMap($websiteUrl)
    {
        $urls = array();
        foreach ($this->pageTreeCollection->getPages() as $pageTree) {
            $page = $pageTree->getPage();
            if ( ! $page->getIsPublished()) {
                continue;
            }

            $seo = $pageTree->getSeo();
            $permalink = "";
            if ( ! $pageTree->getLanguage()->getMainLanguage() || ! $page->getIsHome()) {
                $permalink = $seo->getPermalink();
            }

            $urls[] = array(
                'href' => $websiteUrl . $permalink,
                'frequency' => $seo->getSitemapChangefreq(),
                'priority' => $seo->getSitemapPriority()
            );
        }

        return $this->templating->render('RedKiteCmsBundle:Sitemap:sitemap.html.twig', array('urls' => $urls));
    }