-
Notifications
You must be signed in to change notification settings - Fork 162
Html
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">
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 & Twitter Bootstrap Demo">
<meta name="author" content="Michael Haitz <[email protected]>">
<meta name="X-UA-Compatible" content="IE=edge,chrome=1">
Copyright 2012 AgileCoders.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.