[whatwg] HTML as a text format: Should <title> be optional?

Brian Campbell Brian.P.Campbell at dartmouth.edu
Wed Sep 23 13:30:27 PDT 2009

On Jun 4, 2009, at 6:42 PM, Ian Hickson wrote:

> On Fri, 17 Apr 2009, Øistein E. Andersen wrote:
>> A <title> is usually a good idea, but is it really necessary to  
>> require
>> this for conformance?  After all, a <title> is not something which an
>> author is likely to forget, and leaving it out has no unexpected
>> consequences.
> Leaving it out has a pretty important consequence, it breaks user
> interfaces that need to refer to the document, e.g. "bookmarks"  
> features
> in browsers.

HTML documents sometimes occur in places in which they are not  
independently bookmarkable, such as in an HTML email, or embedded in  
an Atom or RSS feed.

They also sometimes occur in places in which it's generally not  
expected that someone will bookmark them, nor particularly easy to do  
so, such as within an iframe which is being used for a gadget or some  
sort of sandboxed content that isn't really independent of the  
containing page.

> On Sat, 18 Apr 2009, Randy Drielinger wrote:
>> If you're converting from a textfile, title could refer to the  
>> filename.
>> If it's an automated process, it can be added by default.
>> If it's manual, they'll have to remember the short html5 doctype  
>> and the
>> title element.
> It does indeed seem easy to include it.

Yes, but sometimes you don't have a reasonable value for the title.  
Say you are converting some word processing document format to HTML  
(or spreadsheet, or slides, or anything of the sort); what would you  
use if there isn't any sort of heading to take the title from?

There are several options (you could use the filename, or look for  
anything heading like, or use the first couple of words), but if a  
<title> element is missing, then the user agent could do the same.

> On Sat, 18 Apr 2009, Øistein E. Andersen wrote:
>> It could, but chances are that the original filename would  
>> typically be
>> less useful than the URL, which is what most browsers use when the
>> <title> element is omitted, so this rather sounds like an argument
>> against forcing authors to include a <title>.
> I don't see why this would be the case. In practice, however, if one  
> is at
> a loss as to what to use for the <title>, but one has an <h1>, then I
> would recommend using the <h1>'s contents.

This has the problem of duplicating content, which may get out of  
sync. And why can't the user agent just extract the title from the  
heading if it needs it rather than the generator?

>> Yes, my concern is that a validator should be useful as an authoring
>> tool and not overwhelm the author with spurious errors.  As I see it,
>> leaving out <title> is very much like leaving out a paragraph of text
>> and not something that should matter for validation.
> As it affects user interfaces, and since the cost of including a  
> <title>
> is so low, I think it makes sense to continue to make it required.

As it's something that affects the user interface in a fairly visible  
way, it's not likely that many authors will neglect to use it if it's  
useful to do so. However, in some cases it is not possible to include  
a title, or there isn't any really useful title to include, so I'm not  
sure why it should be required in those cases.

This seems somewhat analogous to the <img alt> case; there are some  
times when you don't have any useful text to put in there, and putting  
in auto-generated placeholder text just to conform seems less than  
useful. The number of pages unhelpfully titled "Untitled" or "Untitled  
page" seems to confirm this.

There are other cases in which a title just isn't all that useful,  
like an iframe; the title will be invisible, and it's pretty uncommon  
for people to open that iframe in a new tab and then bookmark it from  
there (unless maybe they happen to be web geeks like us). For example,  
see Google Gadgets <http://www.google.com/webmasters/gadgets/>, or  
iframe sandboxes used for isolating untrusted content while still  
being inline in the page.

So, my recommendation is that <title> be made optional; perhaps a  
validator could issue a warning if you leave it off, but there are  
perfectly valid cases of wanting to produce an HTML document that  
doesn't have any sort of meaningful title or for which a title will  
never be seen or used, it doesn't seem likely that people will forget  
it in cases in which it's useful, and right now it is sometimes being  
filled with useless values like "Untitled" that actually get in the  
way of a UA computing a better value (such as the URL or the top level  

-- Brian Campbell

More information about the whatwg mailing list