Class Meta


@Marshalled(typeName="meta") public class Meta extends HtmlElementVoid<Meta>
DTO for an HTML <meta> element.

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 Details

    • Meta

      public Meta()
      Creates an empty Meta element.
  • Method Details

    • charset

      public Meta charset(String value)
      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 be null to unset the attribute.
      Returns:
      This object.
    • content

      public Meta content(String value)
      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 be null to unset the attribute.
      Returns:
      This object.
    • httpequiv

      public Meta httpequiv(String value)
      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 be null to unset the attribute.
      Returns:
      This object.
    • name

      public Meta name(String value)
      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 be null to unset the attribute.
      Returns:
      This object.