You are here

function biblio_scholar_preprocess_node in Biblio Scholar 6

Same name and namespace in other branches
  1. 7 biblio_scholar.module \biblio_scholar_preprocess_node()

@file Add Google Scholar metatags to Biblio node pages

File

./biblio_scholar.module, line 8
Add Google Scholar metatags to Biblio node pages

Code

function biblio_scholar_preprocess_node($variables) {
  if ($variables['type'] == 'biblio') {
    drupal_set_html_head('<meta name="citation_title" content="' . check_plain($variables['title']) . '"/>');

    //Sort out the authors
    foreach ($variables['biblio_contributors'][1] as $author) {
      drupal_set_html_head('<meta name="citation_author" content="' . check_plain($author['name']) . '"/>');
    }
    if ($variables['biblio_year'] != '') {
      drupal_set_html_head('<meta name="citation_publication_date" content="' . check_plain($variables['biblio_year']) . '"/>');
    }
    if ($variables['biblio_secondary_title'] != '') {
      drupal_set_html_head('<meta name="citation_journal_title" content="' . check_plain($variables['biblio_secondary_title']) . '"/>');
    }
    if ($variables['biblio_volume'] != '') {
      drupal_set_html_head('<meta name="citation_volume" content="' . check_plain($variables['biblio_volume']) . '"/>');
    }
    if ($variables['biblio_issue'] != '') {
      drupal_set_html_head('<meta name="citation_issue" content="' . check_plain($variables['biblio_issue']) . '"/>');
    }
    if ($variables['biblio_isbn'] != '') {
      drupal_set_html_head('<meta name="citation_isbn" content="' . check_plain($variables['biblio_isbn']) . '"/>');
    }
    if ($variables['biblio_issn'] != '') {
      drupal_set_html_head('<meta name="citation_issn" content="' . check_plain($variables['biblio_issn']) . '"/>');
    }
    if ($variables['biblio_section'] != '') {
      drupal_set_html_head('<meta name="citation_firstpage" content="' . check_plain($variables['biblio_section']) . '"/>');
    }
    if (!empty($variables['files'])) {
      foreach ($variables['files'] as $file) {
        if (substr($file->filepath, -3) == 'pdf') {
          drupal_set_html_head('<meta name="citation_pdf_url" content="' . url($file->filepath, array(
            'absolute',
          )) . '"/>');
        }
      }
    }
  }
}