Skip to content
l0rdn1kk0n edited this page Jul 23, 2012 · 7 revisions

Html Tag

The HtmlTag is a TransparentWebMarkupContainer which adds some attributes like lang and class to the html tag.

new HtmlTag("html").locale(Locale.ENGLISH)
<!DOCTYPE html>
<html wicket:id="html" xmlns:wicket="http://wicket.apache.org">
    <head>

the generated markup will look like (with useModernizr(true)):

<!-- all none IE Browsers and IE > 8 -->
<html class="no-js" lang="en">
<!-- IE < 7 -->
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en">

Meta Tag

A MetaTag gives you a simple ability to add meta tags to your page header. It automatically detects the correct attribute name for most of the http-equiv tags like Content-Type or Refresh, also it is possible to override this behavior by adding a MetaTag.Type: new MetaTag("id", Model.of("name")).type(MetaTag.Type.HttpEquiv). There are also some predefined meta tags like ChromeFrameMetaTag and OptimizedMobileViewportMetaTag.

add(new OptimizedMobileViewportMetaTag("viewport"));
add(new ChromeFrameMetaTag("chrome-frame"));
add(new MetaTag("description", Model.of("description"), Model.of("Apache Wicket & Twitter Bootstrap Demo")));
add(new MetaTag("author", Model.of("author"), Model.of("Michael Haitz <[email protected]>")));
<!DOCTYPE html>
<html>
    <head>
        <meta wicket:id="viewport">
        <meta wicket:id="description">
        <meta wicket:id="author">
        <meta wicket:id="chrome-frame">

Result:

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
        <meta name="description" content="Apache Wicket &amp; Twitter Bootstrap Demo">
        <meta name="author" content="Michael Haitz &lt;[email protected]&gt;">
        <meta name="X-UA-Compatible" content="IE=edge,chrome=1">
Clone this wiki locally