Generates the sitemap.xml from the collected HTML page links
962504
def create_sitemap(app, exception):
    """"""
    if (not app.config['html_theme_options'].get('base_url', '') or
           exception is not None or
           not app.sitemap_links):
        return

    filename = app.outdir + "/sitemap.xml"
    print("Generating sitemap.xml in %s" % filename)

    root = ET.Element("urlset")
    root.set("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")

    for link in app.sitemap_links:
        url = ET.SubElement(root, "url")
        ET.SubElement(url, "loc").text = link

    ET.ElementTree(root).write(filename)
155312
function Generate()
    {
        if ($this->cacher->MustUseCache())
        {
            $this->xml = $this->cacher->GetFromCache();
            return;
        }
        $this->AddAllPages();
        $this->xml = $this->sitemap->SaveXml();
        if ($this->cacher->MustStoreToCache())
        {
            $this->cacher->StoreToCache($this->xml);
        }
    }
853133
@Override
    public void generate(Site site) {
        log.debug("Generating paginate pages...");

        List<Page> pages = site.getAllPages();
        SiteConfig config = site.getConfig();

        List<Page> allNewPages = new ArrayList<Page>();
        for (Page page : pages) {
            if (isPaginationEnabled(config, page)) {

                log.debug("[{}]: Paginating...", page.getUrl());
                List<Page> newPages = paginate(site, page);
                if (newPages != null) {
                    allNewPages.addAll(newPages);
                }
            }
        }

        if (!allNewPages.isEmpty()) {
            log.debug("Add {} paginated pages.", allNewPages.size());
            for(Page page: allNewPages){
                site.addPage(page);
                log.debug(page.getUrl());
            }
        }
    }
582989
private Map<String, SiteLink> copySiteLinks(Map<String, SiteLink> siteLinks) {
		if (filter.excludeAllSiteLinks()) {
			return Collections.emptyMap();
		}

		Map<String, SiteLink> result = new HashMap<>(siteLinks.size());
		for (Entry<String, SiteLink> entry : siteLinks.entrySet()) {
			if (filter.includeSiteLink(entry.getKey())) {
				result.put(entry.getKey(), copy(entry.getValue()));
			}
		}
		return result;
	}
324562
def to_string(self):
        """"""
        root = etree.Element('urlset', nsmap={None: SITEMAP_NS})
        for url in self.urls:
            url.generate(root)
        return etree.tostring(root, pretty_print=True, xml_declaration=True,
                              encoding='utf-8')
1068645
def start_output (self):
        """"""
        super(SitemapXmlLogger, self).start_output()
        self.xml_start_output()
        attrs = {u"xmlns": u"http://www.sitemaps.org/schemas/sitemap/0.9"}
        self.xml_starttag(u'urlset', attrs)
        self.flush()
954038
def gen_post_map(file_name, ext_url=''):
    '''
    
    '''
    with open(file_name, 'a') as fout:
        for kind_key in router_post:
            recent_posts = MPost.query_all(kind=kind_key, limit=1000000)
            for recent_post in recent_posts:
                url = os.path.join(SITE_CFG['site_url'],
                                   router_post[recent_post.kind],
                                   ext_url,
                                   recent_post.uid)
                fout.write('{url}\n'.format(url=url))
190039
function generateSitemap(batfishConfig: BatfishConfiguration): Promise<void> {
  const sitemapWriter = fs.createWriteStream(
    path.join(batfishConfig.outputDirectory, 'sitemap.xml')
  );
  return new Promise((resolve, reject) => {
    sitemapWriter.on('error', reject);
    sitemapWriter.on('finish', () => resolve());

    sitemapStatic(sitemapWriter, {
      findRoot: batfishConfig.outputDirectory,
      prefix: joinUrlParts(
        String(batfishConfig.siteOrigin),
        String(batfishConfig.siteBasePath),
        ''
      ),
      pretty: true
    });
  });
}
952388
public void gotoSitemap() {

        final String sitemapUri = CmsCoreProvider.get().link(m_controller.getData().getSitemapUri());
        if (sitemapUri.equals("")) {
            return; // normally, we shouldn't even get to this point because the sitemap button should be disabled
        }
        Command leaveCommand = new Command() {

            public void execute() {

                Window.Location.replace(
                    sitemapUri
                        + "?"
                        + CmsCoreData.PARAM_PATH
                        + "="
                        + CmsContainerpageController.getCurrentUri()
                        + "&"
                        + CmsCoreData.PARAM_RETURNCODE
                        + "="
                        + m_controller.getReturnCode());
            }

        };
        leavePage(leaveCommand);
    }
855950
def _gen_pool_xml(name,
                  ptype,
                  target=None,
                  permissions=None,
                  source_devices=None,
                  source_dir=None,
                  source_adapter=None,
                  source_hosts=None,
                  source_auth=None,
                  source_name=None,
                  source_format=None):
    '''
    
    '''
    hosts = [host.split(':') for host in source_hosts or []]
    context = {
        'name': name,
        'ptype': ptype,
        'target': {'path': target, 'permissions': permissions},
        'source': {
            'devices': source_devices or [],
            'dir': source_dir,
            'adapter': source_adapter,
            'hosts': [{'name': host[0], 'port': host[1] if len(host) > 1 else None} for host in hosts],
            'auth': source_auth,
            'name': source_name,
            'format': source_format
        }
    }
    fn_ = 'libvirt_pool.jinja'
    try:
        template = JINJA.get_template(fn_)
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template %s', fn_)
        return ''
    return template.render(**context)
906364
function sitemap(app) {
    let html
    return (req, res) => {
        if(!html) html = view(parseRoutes(app))
        res.set({
            'Content-Type': 'text/html',
            'Content-Length': html.length
        })
        res.send(html)
    }
}
305827
public function generateIndex()
	{
		$this->loadClosures();

		$xml = new XMLWriter();
		$xml->openMemory();

		$xml->writeRaw('<?xml version="1.0" encoding="UTF-8"?>');
		$xml->writeRaw('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');

		foreach ($this->entries as $data) {
			$xml->startElement('sitemap');

			foreach ($data as $attribute => $value) {
				$xml->writeElement($attribute, $value);
			}

			$xml->endElement();
		}

		$xml->writeRaw('</sitemapindex>');

		return $xml->outputMemory();
	}
912903
function publishSiteMaps () {
    var path = 'sitemap.xml';

    return publishRobotsTxt ()
        .then(function () {
            return fs.statAsync(path);
        })
        .then(function (pStat) {
            if (pStat.isFile()) {
                // file exists; throw Error to proceed with creating of sitemaps for posts and tags
                return publishPostsSiteMap()
                    .then(function () {
                        return publishTagsSiteMap();
                    })
                    .catch(log.error);
            }
            else {
                // create sitemap.xml file
                throw new Error();
            }
        })
        .catch(function () {
            var sitemap = sm.createSitemap ({
                hostname: config.siteUrl,
                cacheTime: 600000,        // 600 sec - cache purge period
                urls: [{
                        url: '/sitemap-posts.xml',
                        changeFreq: 'weekly',
                        priority: 0.8,
                        lastmodrealtime: true
                    },
                    {
                        url: '/sitemap-tags.xml',
                        changeFreq: 'weekly',
                        priority: 0.8,
                        lastmodrealtime: true
                    }]
            });

            return fs
                .openAsync(path, 'w')
                .then(function () {
                    return fs
                        .writeFileAsync(path, sitemap.toString())
                        .then(function () {
                            // file exists; throw Error to proceed with creating of sitemaps for posts and tags
                            return publishPostsSiteMap().then(function () {
                                return publishTagsSiteMap().catch(log.error);
                            });
                        })
                        .catch(log.error);
                })
                .catch(log.error);
        });
}
1222690
def make_page(file_path, collection: "posts", category: nil)
      PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
        file.content = feed_template
        file.data.merge!(
          "layout"     => nil,
          "sitemap"    => false,
          "xsl"        => file_exists?("feed.xslt.xml"),
          "collection" => collection,
          "category"   => category
        )
        file.output
      end
    end
718061
def html_page_context(app, pagename, templatename, context, doctree):
    ''' 

    '''
    site = context['SITEMAP_BASE_URL']
    version = context['version']
    app.sitemap_links.add(site + version + '/' + pagename + ".html")
847567
def sitemap(self):
        """"""
        if (self.sitemap_name is not None):
            return(self.sitemap_name)
        return(self.sitemap_uri(self.resource_list_name))
893078
public function actionIndex()
    {
        $dataHandler = new SitemapDataHandler($this->savePathAlias, $this->sitemapFileName, [
            'builderConfig' => $this->builderConfig,
        ]);

        $models = $dataHandler->getModelsClasses($this->modelsPath, $this->modelsNamespace);
        $dataHandler->handleModels($models);
    }