You are here

function _xmlsitemap_additional_links in XML sitemap 5

Get additional links.

Return value

An array of links. Each link is an array containing the XML values for a site map URL.

Related topics

1 call to _xmlsitemap_additional_links()
xmlsitemap_xmlsitemap_links in ./xmlsitemap.module
Implementation of hook_xmlsitemap_links().

File

./xmlsitemap.module, line 638
Creates a site map compatible with the sitemaps.org schema.

Code

function _xmlsitemap_additional_links() {
  $links = array();
  $result = db_query("\n    SELECT xa.*, ua.dst AS alias FROM {xmlsitemap_additional} xa\n    LEFT JOIN {url_alias} ua ON xa.pid = ua.pid\n  ");
  while ($link = db_fetch_object($result)) {
    $age = time() - $link->last_changed;
    if (!empty($link->previously_changed)) {
      $interval = $link->last_changed - $link->previously_changed;
    }
    else {
      $interval = 0;
    }
    $links[] = array(
      '#loc' => xmlsitemap_url($link->path, $link->alias, NULL, NULL, TRUE),
      '#lastmod' => $link->last_changed,
      '#changefreq' => max($age, $interval),
      '#priority' => isset($link->priority) ? $link->priority : variable_get('xmlsitemap_additional_links_priority', 0.1),
    );
  }
  return $links;
}