001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#the-title-element"><title></a> 023 * element. 024 * 025 * <p> 026 * The title element represents the document's title or name. It is used to provide a title 027 * for the document that appears in the browser's title bar, bookmarks, and search engine 028 * results. The title element should be placed within the head element and should be descriptive 029 * and unique for each page. It is important for SEO, accessibility, and user experience as 030 * it helps users identify the page content and purpose. 031 * 032 * <h5 class='section'>Examples:</h5> 033 * <p class='bcode w800'> 034 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 035 * 036 * <jc>// Simple page title</jc> 037 * Title <jv>simple</jv> = <jsm>title</jsm>(<js>"Welcome to My Website"</js>); 038 * 039 * <jc>// Title with dynamic content</jc> 040 * Title <jv>dynamic</jv> = <jsm>title</jsm>(<js>"User Dashboard - "</js> + <jv>username</jv>); 041 * 042 * <jc>// Title with branding</jc> 043 * Title <jv>branded</jv> = <jsm>title</jsm>(<js>"About Us | My Company"</js>); 044 * 045 * <jc>// Title with SEO keywords</jc> 046 * Title <jv>seo</jv> = <jsm>title</jsm>(<js>"Best Coffee Shops in Seattle - 2024 Guide"</js>); 047 * 048 * <jc>// Title with separator</jc> 049 * Title <jv>separated</jv> = <jsm>title</jsm>(<js>"Contact Us - Get in Touch"</js>); 050 * 051 * <jc>// Title with emoji</jc> 052 * Title <jv>emoji</jv> = <jsm>title</jsm>(<js>"🎉 Welcome to Our Store!"</js>); 053 * </p> 054 * 055 * <h5 class='section'>See Also:</h5><ul> 056 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 057 * </ul> 058 */ 059@Marshalled(typeName = "title") 060public class Title extends HtmlElementRawText<Title> { 061 062 /** 063 * Creates an empty {@link Title} element. 064 */ 065 public Title() {} 066 067 /** 068 * Creates a {@link Title} element with the specified {@link Title#text(Object)} node. 069 * 070 * @param text The {@link Title#text(Object)} node. Can be <jk>null</jk> to leave the text unset. 071 */ 072 public Title(String text) { 073 text(text); 074 } 075}