function theme_add_google_appliance_meta_tags in Google Search Appliance 5
1 theme call to theme_add_google_appliance_meta_tags()
- _google_appliance_add_meta_tags in ./
google_appliance.module - Invokes the google_appliance_appconfig hook to add <meta> tags to nodes for indexing metadata by the google crawler.
File
- ./
google_appliance.module, line 397 - GSA integration
Code
function theme_add_google_appliance_meta_tags($node) {
// create list of tags to add
$results = array();
/**
* Adding taxonomy tags
*/
$vocabs = taxonomy_get_vocabularies();
if (module_exists('nat') && $node->nat) {
$node->taxonomy = array_merge($node->nat, $node->taxonomy);
//$node->taoxnomy[] = $
}
foreach ($node->taxonomy as $term) {
$tagname = 'category-' . strtolower($vocabs[$term->vid]->name);
$results[] = array(
$tagname,
$term->name,
);
}
/**
* Adding sort date IMPORTANT: for sorting, mini must be configured to use htis tag
*/
$results[] = array(
'date',
date('Y-m-d h:i:s', $node->changed),
);
$results[] = array(
'created',
date('Y-m-d h:i:s', $node->created),
);
/**
* Normally this doesn't matter,
* but if you want to allow the gsa to
* access unpublished pages and later filter
* on this you will need it.
*/
$results[] = array(
'status',
$node->status,
);
/**
* i18n configuration
*/
if ($node->language) {
$results[] = array(
'content-language',
$node->language,
);
}
/**
* node type
*/
$results[] = array(
'type',
$node->type,
);
/**
* Author
*/
$node->uid = empty($node->uid) ? 0 : $node->uid;
$user = user_load(array(
'uid' => 0,
));
$user->name = empty($user->name) ? 'anonymous' : $user->name;
$results[] = array(
'author' => $user->name,
);
// add meta tags
foreach ($results as $res) {
list($name, $content) = $res;
$content = strip_tags($content);
drupal_set_html_head('<meta name="' . htmlentities($name) . '" content="' . htmlentities($content) . '" />');
}
}