Commit 83b33429 authored by Mattia Migliorini's avatar Mattia Migliorini

Add meta viewport and charset, remove meta content-type and generator

There should be a better way to add meta tags, but I did not find a working solution
parent 936c6815
......@@ -17,8 +17,56 @@
* @since 1.0.0
*/
error_reporting(E_ALL);
ini_set('display_errors',1);
/**
* Alter the <head> section contents.
*
* Default contents:
* ```
* array(3) {
* ["system_meta_content_type"]=> array(4) {
* ["#type"]=> string(8) "html_tag"
* ["#tag"]=> string(4) "meta"
* ["#attributes"]=> array(2) {
* ["http-equiv"]=> string(12) "Content-Type"
* ["content"]=> string(24) "text/html; charset=utf-8"
* }
* ["#weight"]=> int(-1000)
* }
* ["system_meta_generator"]=> array(4) {
* ["#type"]=> string(8) "html_tag"
* ["#tag"]=> string(4) "meta"
* ["#attributes"]=> array(2) {
* ["name"]=> string(9) "Generator"
* ["content"]=> string(28) "Drupal 7 (http://drupal.org)"
* }
* ["#attached"]=> array(1) {
* ["drupal_add_http_header"]=> array(1) {
* [0]=> array(2) {
* [0]=> string(11) "X-Generator"
* [1]=> string(28) "Drupal 7 (http://drupal.org)"
* }
* }
* }
* }
* ["drupal_add_html_head_link:shortcut icon:http://uit-test/misc/favicon.ico"]=> array(3) {
* ["#tag"]=> string(4) "link"
* ["#attributes"]=> array(3) {
* ["rel"]=> string(13) "shortcut icon"
* ["href"]=> string(32) "http://uit-test/misc/favicon.ico"
* ["type"]=> string(24) "image/vnd.microsoft.icon"
* }
* ["#type"]=> string(8) "html_tag"
* }
* }
* ```
*
* @since 0.1.1
*
* @param array $elements Head elements. Passed by reference.
*/
function valencia_html_head_alter( &$elements ) {
unset( $elements['system_meta_content_type'], $elements['system_meta_generator'] );
}
/**
* Add external scripts and styles.
......@@ -180,20 +228,6 @@ function valencia_preprocess_page( &$vars ) {
// Add the rendered output to menu
$vars['valencia_menu'] = menu_tree_output($main_menu_tree);
/**
* Add meta viewport to page head.
*
* @since 0.1.1
*/
$viewport = array(
'#tag' => 'meta', // The HTML tag - <meta />
'#attributes' => array( // Array of attributes for the tag.
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1.0'
)
);
drupal_add_html_head( $viewport, 'viewport' );
}
/**
......
......@@ -47,6 +47,8 @@
<html lang="<?php print $language->language; ?>">
<head profile="<?php print $grddl_profile; ?>">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="charset" content="utf-8">
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment