HTML5 support via XML "switch" in Joomla! templates
Although there have been other requests to add HTML5 support for Joomla!, I think the proposed solutions may complicate things...
Here's a simpler one: let the template developer "choose" HTML5 in the templateDetails.xml file and have Joomla! generate the HTML5 equivalent meta tags that it currently outputs in <jdoc:include type="head" />...
A DEEPER EXPLANATION
A simple solution to "attach" HTML5 per template and not entirely on a Joomla! site is to add a new XML api call in the templateDetails.xml where a template developer can declare if their template is HTML5 compatible or not. Something like:
That way we can have HTML5 and non-HTML5 templates installed on our Joomla site, without breaking compliance where required. And we can still switch templates per Joomla! site section using different doctypes.
The other proposed solutions either refer to complete code refactoring (takes time) or a "global site switch" in the Global Configuration options (which toggles the entire site HTML5 or not - causes issues where HTML5 may not be suited).
If we let the template developer decide on the HTML doctype, we provide more freedom and flexibility for a better result.
If Joomla! adds options to automatically attach e.g. a js library that makes new HTML5 elements compatible with IE (html5shiv.js for example), we complicate things further, as happened with Mootools in the past. Let the template developer decide on stuff like that too.
All Joomla! needs to do is spit out the right meta info per the HTML5 spec (e.g. <meta charset="utf-8" />). In other words, generate the HTML5 equivalent of existing HTML4 meta tags as output by <jdoc:include type="head" />...
html5 switch is available in Beez template since Joomla 1.6,
recently there has been added a pull request to add simple html5 support to JDocument (https://github.com/joomla/joomla-platform/pull/699#issuecomment-3352689)
Rafael Santana commented
me encanta la idea
Mirko Mikan commented
Très bonne idée
Mark Simpson commented
I would argue though, that the default should be HTML5.
William White, Jr. commented
@malber_o2m - this idea will allow Joomla to output the HTML needed to fully use html5 Boilerplate (HTML).
Would the HTML5 Boilerplate project http://html5boilerplate.com/ help?
@JoomlaWorks - Your XML switch solution is the perfect way to deal with Joomla HTML5 output for head data, links, styles and form elements (much better than the global switch I suggested - I moved my votes from it to this).
More power to the template dev!
But, unfortunately, when it comes to modules I still believe that there is no other way to fully support HTML5 correctly without putting selection of the wrapping tag in the modules params.
The main issue is the distinction between relevant & non-relevant page content (ie. if aside should be used or not). This is something a template dev could not predict in every situation. I've looked at this many different ways, and module params/chrome seems to be the only logical solution for full HTML5 support.
Whilst the mod-chrome and HTML5 switch ideas are related they could be implemented separately (with the switch as a priority of course).
AdminRouven Weßling (Admin, Joomla!) commented
AFAIK 2.5 is planned for January 2012.
@James Durrant Since the template developer has full freedom even there, it's not necessary to have Joomla! core output HTML5. Remember that the key to the solution mentioned is that people who want HTML4 or XHTML1.1, can still make use of these older doctypes.
I also support your proposal for using:
...in the template xml file. Much cleaner and future proof!
Let's vote for this folks! Come on!
@Rouven Weßling Thanks for trying to push this for 2.5 (ETA is Feb 2012, right?).
With so much going in the HTML5 <head>, why not give options to override the default head.php? I've just had a peek at J1.7 backend. What are those horrid curly corners about?
Flor Coppola commented
I like your idea!
@JoomlaWorks - of course module chrome can be overwritten, but a core module chrome solution would still be useful.
Modules can contain any number of content types that could be navigation, relevant page content, non-relevant page content or small-print - nav, small, aside, header, section, footer, div, etc could be used in many different ways. A template developer could not possibly predict all the ways a site builder/admin would want to identify or order their modules.
If a drop-down menu in the module params (listing available wrapping tags and defaulting to a div) was used, a template dev could then use a core or override module chrome style in each JDOC:module placeholder where relevant.
HTML5 is here right now. It's what clients want. Joomla is in danger of being left way behind.
I'm voting with hands and feet ;)
AdminRouven Weßling (Admin, Joomla!) commented
FYI I showed code with a very similar approach a few months back to the bug squad and will try to get it into 2.5.
Great Idea - am all for it!
@James Durrant Module containers can be overwritten by template developers, that's why I proposed this solution. Full freedom to template devs and you can easily have any site switch to HTML5! ;)