Posted by beckyjohnson on April 22, 2013 at 3:32am
I am using the html5 starter theme but I don't understand why the doc type isn't actually the HTML5 doctype.
If I go though and find the file for the header in the Alpha folder, can I change the doctype with out breaking the alpha and omega layers of this theme? It just doesn't make sense to me to use the HTML5 theme when the doctype isn't even recognizing that you are using HTML5.
Rebecca
Comments
HTML 5 Doctype
Good morning,
Unless you are quoting from a different source, the only thing required in HTML5 is:
<!DOCTYPE html>No DTD is required with HTML5.
I've put up a few sites using Omega, and had no issues about HTML5 compatibility.
If you are looking on more information of HTML Doctypes, here is a source:
http://www.w3schools.com/tags/tag_doctype.asp
Hi Becky,all you need to do
Hi Becky,
all you need to do is place the following function in your subthemes template.php
/**
* Implements hook_preprocess_html().
**/
function YOURTHEMENAME_preprocess_html(&$vars) {
$vars['doctype'] = '<!DOCTYPE html>' . "\n";
$vars['rdf'] = new stdClass;
$vars['rdf']->version = '';
$vars['rdf']->namespaces = '';
$vars['rdf']->profile = '';
// Serialize RDF Namespaces into an RDFa 1.1 prefix attribute.
if ($vars['rdf_namespaces']) {
$prefixes = array();
foreach (explode("\n ", ltrim($vars['rdf_namespaces'])) as $namespace) {
// Remove xlmns: and ending quote and fix prefix formatting.
$prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
}
$vars['rdf']->namespaces = ' prefix="' . implode(' ', $prefixes) . '"';
}
}
And that will take care of
<!DOCTYPE html>as well as, some RDF issues and your subtheme will validate in w3c without any issues.Drupal web developer and Search Engine Optimisation consultant at Webmar Design & Development Brisbane, Australia
Google+
Thank you Kristina! This is
Thank you Kristina! This is great, I should have realized I could do a hook_process_html. Not that great at php yet though. Where did you learn about this snippit of code?
Becky
You're welcome Becky :) There
You're welcome Becky :) There is a few of them around in Omega issue queue and on various blogs but this one is a slightly stripped version of the code from Omega 3.x dev release. I'm using it on my own site and its working well.
If you're an Omega fan perhaps you'll be interested in joining a little Omega community I started on Google+ with approval from himerus https://plus.google.com/u/0/communities/106202476084246774575 We are only a few weeks young but I've already posted some useful and tested solutions for Omega (and I hope others will too).
Drupal web developer and Search Engine Optimisation consultant at Webmar Design & Development Brisbane, Australia
Google+
That sounds great. I'll join
That sounds great. I'll join soon!