You are here

public function Simplesitemap::generate_sitemap in Simple XML sitemap 8

Generates the sitemap for all languages and saves it to the db.

1 call to Simplesitemap::generate_sitemap()
Simplesitemap::get_sitemap in src/Simplesitemap.php
Returns the whole sitemap, a requested sitemap chunk, or the sitemap index file.

File

src/Simplesitemap.php, line 174
Contains \Drupal\simplesitemap\Simplesitemap.

Class

Simplesitemap
Simplesitemap class.

Namespace

Drupal\simplesitemap

Code

public function generate_sitemap() {
  Cache::invalidateTags(array(
    'simplesitemap',
  ));
  $generator = new SitemapGenerator();
  $generator
    ->set_custom_links($this
    ->get_config('custom'));
  $generator
    ->set_entity_types($this
    ->get_config('entity_types'));
  $this->sitemap = $generator
    ->generate_sitemap($this
    ->get_setting('max_links'));
  $this
    ->save_sitemap();
}