docs.rodeo

MDN Web Docs mirror

: The Document Title element</h1> <p><code>{{HTMLSidebar}}</code> </p> <p>The <strong><code><title></code></strong> <a href="/en-US/docs/Web/HTML">HTML</a> element defines the document’s title that is shown in a <code>{{glossary("Browser", "browser")}}</code> 's title bar or a page’s tab. It only contains text; tags within the element are ignored.</p> <pre class="hljs"><code data-language="html"><span class="hljs-tag"><<span class="hljs-name">title</span>></span>Grandma's Heavy Metal Festival Journal<span class="hljs-tag"></<span class="hljs-name">title</span>></span> </code></pre> <h2 id="attributes">Attributes</h2> <p>This element only includes the <a href="/en-US/docs/Web/HTML/Global_attributes">global attributes</a>.</p> <h2 id="usage-notes">Usage notes</h2> <p>The <code><title></code> element is always used within a page’s <code>{{HTMLElement("head")}}</code>  block.</p> <h3 id="page-titles-and-seo">Page titles and SEO</h3> <p>The contents of a page title can have significant implications for search engine optimization (<code>{{glossary("SEO")}}</code> ). In general, a longer, descriptive title performs better than short or generic titles. The content of the title is one of the components used by search engine algorithms to decide the order in which to list pages in search results. Also, the title is the initial “hook” by which you grab the attention of readers glancing at the search results page.</p> <p>A few guidelines and tips for composing good titles:</p> <ul> <li>Avoid one- or two-word titles. Use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages.</li> <li>Search engines typically display about the first 55–60 characters of a page title. Text beyond that may be lost, so try not to have titles longer than that. If you must use a longer title, make sure the important parts come earlier and that nothing critical is in the part of the title that is likely to be dropped.</li> <li>Don’t use “keyword blobs.” If your title is just a list of words, algorithms often reduce your page’s position in the search results.</li> <li>Try to make sure your titles are as unique as possible within your own site. Duplicate—or near-duplicate—titles can contribute to inaccurate search results.</li> </ul> <h2 id="accessibility">Accessibility</h2> <p>It is important to provide an accurate and concise title to describe the page’s purpose.</p> <p>A common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. This is because navigating into a page to determine its content can be a time-consuming and potentially confusing process. Titles should be unique to every page of a website, ideally surfacing the primary purpose of the page first, followed by the name of the website. Following this pattern will help ensure that the primary purpose of the page is announced by a screen reader first. This provides a far better experience than having to listen to the name of a website before the unique page title, for every page a user navigates to in the same website.</p> <h3 id="examples">Examples</h3> <pre class="hljs"><code data-language="html"><span class="hljs-tag"><<span class="hljs-name">title</span>></span>Menu - Blue House Chinese Food - FoodYum: Online takeout today!<span class="hljs-tag"></<span class="hljs-name">title</span>></span> </code></pre> <p>If a form submission contains errors and the submission re-renders the current page, the title can be used to help make users aware of any errors with their submission. For instance, update the page <code>title</code> value to reflect significant page state changes (such as form validation problems).</p> <pre class="hljs"><code data-language="html"><span class="hljs-tag"><<span class="hljs-name">title</span>></span> 2 errors - Your order - Sea Food Store - Food: Online takeout today! <span class="hljs-tag"></<span class="hljs-name">title</span>></span> </code></pre> <blockquote> <p>[!NOTE] Presently, dynamically updating a page’s title will not be automatically announced by screen readers. If you are going to update the page title to reflect significant changes to a page’s state, then the use of <a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions">ARIA Live Regions</a> may be necessary, as well.</p> </blockquote> <ul> <li><a href="/en-US/docs/Web/Accessibility/Understanding_WCAG/Operable#guideline_2.4_%E2%80%94_navigable_provide_ways_to_help_users_navigate_find_content_and_determine_where_they_are">MDN Understanding WCAG, Guideline 2.4 explanations</a></li> <li><a href="https://www.w3.org/WAI/WCAG21/Understanding/page-titled.html" rel="noopener noreferrer" target="_blank">Understanding Success Criterion 2.4.2 | W3C Understanding WCAG 2.1</a></li> </ul> <h2 id="examples-1">Examples</h2> <pre class="hljs"><code data-language="html"><span class="hljs-tag"><<span class="hljs-name">title</span>></span>Awesome interesting stuff<span class="hljs-tag"></<span class="hljs-name">title</span>></span> </code></pre> <p>This example establishes a page whose title (as displayed at the top of the window or in the window’s tab) as “Awesome interesting stuff”.</p> <h2 id="technical-summary">Technical summary</h2> <table class="properties"> <tbody> <tr> <th scope="row"> <a href="/en-US/docs/Web/HTML/Content_categories" >Content categories</a > </th> <td> <a href="/en-US/docs/Web/HTML/Content_categories#metadata_content" >Metadata content</a >. </td> </tr> <tr> <th scope="row">Permitted content</th> <td> Text that is not inter-element `{{glossary("whitespace")}}` . </td> </tr> <tr> <th scope="row">Tag omission</th> <td> Both opening and closing tags are required. Note that leaving off <code></title></code> should cause the browser to ignore the rest of the page. </td> </tr> <tr> <th scope="row">Permitted parents</th> <td> A `{{ HTMLElement("head") }}`  element that contains no other <code><title></code> element. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td> <a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role" >No corresponding role</a > </td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>No <code>role</code> permitted.</td> </tr> <tr> <th scope="row">DOM interface</th> <td>`{{domxref("HTMLTitleElement")}}` </td> </tr> </tbody> </table> <h2 id="specifications">Specifications</h2> <p><code>{{Specifications}}</code> </p> <h2 id="browser-compatibility">Browser compatibility</h2> <p><code>{{Compat}}</code> </p> <h2 id="see-also">See also</h2> <ul> <li>SVG <a href="/en-US/docs/Web/SVG/Element/title"><code><title></code></a> element</li> </ul> </article> <right-rail> <h3>In this article</h3> <nav class="table-of-contents"><ol><li><a href="#attributes">Attributes</a></li><li><a href="#usage-notes">Usage notes</a><ol><li><a href="#page-titles-and-seo">Page titles and SEO</a></li></ol></li><li><a href="#accessibility">Accessibility</a><ol><li><a href="#examples">Examples</a></li></ol></li><li><a href="#examples-1">Examples</a></li><li><a href="#technical-summary">Technical summary</a></li><li><a href="#specifications">Specifications</a></li><li><a href="#browser-compatibility">Browser compatibility</a></li><li><a href="#see-also">See also</a></li></ol></nav> <small><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title" target="_blank">View on MDN</a></small> </right-rail> <footer> <p>Content from <a href="https://github.com/mdn/content" target="_blank">MDN Web Docs</a></p> </footer> </body> </html>