Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The implementation
/**
* Implements hook_html_head_alter().
*/
function omega_html_head_alter(&$head) {
// Simplify the meta tag for character encoding.
$head['system_meta_content_type']['#attributes'] = array(
'charset' => str_replace('text/html; charset=', '', $head['system_meta_content_type']['#attributes']['content']),
);
}
in combination with the default html.tpl.php leads to invalid HTML markup if
if (omega_extension_enabled('compatibility') && omega_theme_get_setting('omega_conditional_classes_html', TRUE)):
in the template return true.
You can reproduce this when validating a site meeting the mentioned conditions with the W3C validator at http://validator.w3.org/check.
The validator will output the following message:
Proposed resolution
Add the opposite condition of the one in the template within omega_html_head_alter to prevent altering of the tag if conditional classes are added to the markup (which would push the tag out of the first 512 bytes).
Comment | File | Size | Author |
---|---|---|---|
#2 | invalid-markup-in-html-head-2410273-2.patch | 1010 bytes | s_leu |
Screenshot from 2015-01-19 14:05:36.png | 12.09 KB | s_leu |
Comments
Comment #1
s_leu CreditAttribution: s_leu commentedComment #2
s_leu CreditAttribution: s_leu commentedHere's a first patch that adds the corresponding condition.
Comment #3
s_leu CreditAttribution: s_leu commentedSee also this for more information: http://stackoverflow.com/questions/18007771/how-do-i-fix-error-a-charset...