Class Meta
The meta element represents metadata about the document. It provides information about the document that is not displayed to users but is used by browsers, search engines, and other web services. Common uses include character encoding, viewport settings, SEO information, and social media tags.
Examples:
// Character encoding Meta meta1 = meta().charset("utf-8"); // Viewport for responsive design Meta meta2 = meta() .name("viewport") .content("width=device-width, initial-scale=1.0"); // SEO description Meta meta3 = meta() .name("description") .content("This is a sample web page with meta information"); // Open Graph tags for social media Meta meta4 = meta() .property("og:title") .content("My Web Page"); // HTTP-equiv for cache control Meta meta5 = meta() .httpequiv("Cache-Control") .content("no-cache, no-store, must-revalidate");
The following convenience methods are provided for constructing instances of this bean:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.juneau.bean.html5.HtmlElement
accesskey, attr, attrUri, class_, contenteditable, deminimize, dir, getAttr, getAttr, getAttrs, hidden, id, lang, onabort, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, oncuechange, ondblclick, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting, self, setAttrs, spellcheck, style, tabindex, title, toString, translate
-
Constructor Details
-
Method Details
-
charset
charset attribute.Specifies the character encoding for the HTML document. Should be placed early in the document head.
Common values:
"UTF-8" - Unicode UTF-8 encoding (recommended)"ISO-8859-1" - Latin-1 encoding"windows-1252" - Windows-1252 encoding
- Parameters:
value- The character encoding for the document. Can benull to unset the attribute.- Returns:
- This object.
-
content
content attribute.Specifies the value associated with the name or http-equiv attribute. The content varies depending on the type of metadata being defined.
- Parameters:
value- The metadata value (e.g., description text, viewport settings, etc.). Can benull to unset the attribute.- Returns:
- This object.
-
httpequiv
http-equiv attribute.Specifies a pragma directive that simulates an HTTP header. Used with the content attribute.
Common values:
"content-type" - Document content type and character encoding"refresh" - Page refresh or redirect timing"expires" - Document expiration date"cache-control" - Caching directives"pragma" - Cache control (legacy)"set-cookie" - Cookie settings"x-ua-compatible" - Browser compatibility mode
- Parameters:
value- The HTTP header name to simulate. Can benull to unset the attribute.- Returns:
- This object.
-
name
name attribute.Specifies the name of the metadata property. Used with the content attribute to define document metadata.
Common values:
"description" - Page description for search engines"keywords" - Keywords for search engines"author" - Page author"viewport" - Viewport settings for mobile devices"robots" - Instructions for search engine crawlers
- Parameters:
value- The name of the metadata property. Can benull to unset the attribute.- Returns:
- This object.
-