You are here

public function XmlSitemapGenerator::generatePage in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 src/XmlSitemapGenerator.php \Drupal\xmlsitemap\XmlSitemapGenerator::generatePage()

Generate one page (chunk) of the sitemap.

Parameters

XmlSitemapInterface $sitemap: An unserialized data array for an XML sitemap.

string $page: An integer of the specific page of the sitemap to generate.

Overrides XmlSitemapGeneratorInterface::generatePage

1 call to XmlSitemapGenerator::generatePage()
XmlSitemapGenerator::regenerateBatchGenerate in src/XmlSitemapGenerator.php
Batch callback; generate all pages of a sitemap.

File

src/XmlSitemapGenerator.php, line 253

Class

XmlSitemapGenerator
XmlSitemap generator service class.

Namespace

Drupal\xmlsitemap

Code

public function generatePage(XmlSitemapInterface $sitemap, $page) {
  $writer = new XmlSitemapWriter($sitemap, $page);
  $writer
    ->startDocument();
  $this
    ->generateChunk($sitemap, $writer, $page);
  $writer
    ->endDocument();
  return $writer
    ->getSitemapElementCount();
}