A
A
Alexander Ivanov2016-01-11 17:11:26
Drupal
Alexander Ivanov, 2016-01-11 17:11:26

How to add meta tag in Drupal 7?

Explanation: I'm more used to working in MODX.
DRUPAL 7 uses one html.tpl.php template for all pages.
There is a meta-tags module that allows an illiterate (who does not know HTML) moderator to edit the description and keywords.
I need to insert this line <meta property="relap:article" content="false">for some pages.
In MODX I would do it in 10 minutes. In Drupal 7, even the person who made this site cannot help me!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drupby, 2016-01-11
@cimonlebedev

Google -> "drupal 7 add meta tag"
In short, in the theme's template.php add to preprocess_html

function YOUR_THEME_NAME_preprocess_html(&$vars) {

  $relap = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'property' => 'relap:article',
      'content' => 'false',
    )
  );

  drupal_add_html_head($relap, 'relap');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question