You are here

function hook_simple_sitemap_arbitrary_links_alter in Simple XML sitemap 8.2

Same name and namespace in other branches
  1. 8.3 simple_sitemap.api.php \hook_simple_sitemap_arbitrary_links_alter()
  2. 4.x simple_sitemap.api.php \hook_simple_sitemap_arbitrary_links_alter()

Add arbitrary links to the sitemap.

Parameters

array &$arbitrary_links:

1 invocation of hook_simple_sitemap_arbitrary_links_alter()
ArbitraryUrlGenerator::getDataSets in src/Plugin/simple_sitemap/UrlGenerator/ArbitraryUrlGenerator.php
@inheritdoc

File

./simple_sitemap.api.php, line 47
Hooks provided by the Simple XML sitemap module.

Code

function hook_simple_sitemap_arbitrary_links_alter(array &$arbitrary_links) {

  // Add an arbitrary link.
  $arbitrary_links[] = [
    'url' => 'http://this-is-your-life.net/tyler',
    'priority' => '0.5',
    // An ISO8601 formatted date.
    'lastmod' => '2012-10-12T17:40:30+02:00',
    'changefreq' => 'weekly',
    'images' => [
      [
        'path' => 'http://path-to-image.png',
      ],
    ],
    // Add alternate URLs for every language of a multilingual site.
    // Not necessary for monolingual sites.
    'alternate_urls' => [
      'en' => 'http://this-is-your-life.net/de/tyler',
      'de' => 'http://this-is-your-life.net/en/tyler',
    ],
  ];
}