diff --git a/xmlsitemap.admin.inc b/xmlsitemap.admin.inc index 623b41e..f053a5a 100644 --- a/xmlsitemap.admin.inc +++ b/xmlsitemap.admin.inc @@ -752,6 +752,20 @@ function xmlsitemap_add_form_link_options(array &$form, $entity, $bundle, $id) { ), ), ); + //https://www.drupal.org/node/1811692 + if ($entity == 'node') { + $form['xmlsitemap']['changefreq'] = array( + '#type' => 'select', + '#title' => t('Change frequency'), + '#options' => array('default'=>t('Default')) + xmlsitemap_get_changefreq_options(), + '#default_value' => isset($link['changefreq']) ? $link['changefreq'] : 'default', + '#states' => array( + 'invisible' => array( + 'select[name="xmlsitemap[status]"]' => array('value' => '0'), + ), + ), + ); + } if (!$link['status_default']) { // If the default status is excluded, add a visible state on the include // override option. diff --git a/xmlsitemap_node/xmlsitemap_node.module b/xmlsitemap_node/xmlsitemap_node.module index 9005195..a677be3 100644 --- a/xmlsitemap_node/xmlsitemap_node.module +++ b/xmlsitemap_node/xmlsitemap_node.module @@ -196,7 +196,10 @@ function xmlsitemap_node_create_link(stdClass $node) { // Always recalculate changefreq and changecount. $timestamps = xmlsitemap_node_get_timestamps($node); - $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0; + //Change Frequency set from node - https://www.drupal.org/node/1811692 + if ($node->xmlsitemap['changefreq'] == 'default') { + $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0; + } $node->xmlsitemap['changecount'] = $node->nid ? count($timestamps) - 1 : 0; // Node access must be reset since it a user may have changed published status, etc.