You are here

biblio_scholar.module in Biblio Scholar 6

Same filename and directory in other branches
  1. 7 biblio_scholar.module

Add Google Scholar metatags to Biblio node pages

File

biblio_scholar.module
View source
<?php

// $Id$

/**
 * @file
 * Add Google Scholar metatags to Biblio node pages
 */
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',
          )) . '"/>');
        }
      }
    }
  }
}

Functions

Namesort descending Description
biblio_scholar_preprocess_node @file Add Google Scholar metatags to Biblio node pages