1

The obvious answer to this question is HTML code of course, but my deeper question is, is this an HTML body content-like HTML? I suppose I can't put HTML header content-like HTML? Correct? I mean I can't put META tags for example.

3 Answers 3

3

You technically can use <meta> tags, since they will not be stripped out of the content that you place into a textfield that uses the default "full HTML" input filter. However, this content will be output in the <body> of the HTML document, which means using <meta> tags here will cause invalid HTML and most likely be ineffectual.

If you are looking for a way to customize the <meta> tags used on your Drupal site, there are many modules available to help with this. The Meta Tags module is the most popular, but that project's page also lists some other meta tag-related modules.

1

When the full HTML is set as input format, what entered is not filtered in any way; this means that you could also enter tags that are not normally supported where you are adding them, such as <meta> tags that would appear inside the <body> tag, or miss a closing tag, such as in <div><strong>This is wrong</div>.

If you want to avoid both those problems, you could use the filtered input format, and add all the tags you are sure your users need, leaving out tags such as <meta>, which should not be added in the <body> tag.
It would also avoid there aren't tags left open, which would cause layout/formatting problems, when the users leave open tags. In fact, the code used to filter the entered HTML, in that case, is the following one.

  $allowed_tags = preg_split('/\s+|<|>/', $filter->settings['allowed_html'], -1, PREG_SPLIT_NO_EMPTY);
  $text = filter_xss($text, $allowed_tags);

  if ($filter->settings['filter_html_nofollow']) {
    $html_dom = filter_dom_load($text);
    $links = $html_dom->getElementsByTagName('a');
    foreach ($links as $link) {
      $link->setAttribute('rel', 'nofollow');
    }
    $text = filter_dom_serialize($html_dom);
  }
0
1

Drupal themes are broken down into regions, where content and other blocks are displayed. Therefore, you can add any HTML that would be valid inside whatever container your content region is wrapped in (typically a <div>). So the <header> tag would work if you're supporting HTML5, but <head> won't work as you'd expect, because you're putting it in the <body> of your document.

If you want to edit markup outside of that region, or even modify regions, have a look at the breakdown of core templates.

If you're looking to edit <meta> tags specifically, have a look at the Meta tags module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.