Document Title

A document title, while optional, is usually the first element in the document header.

Title syntax

A document title is specified using a single equals sign (=), followed by a space, then the title text.

Example 1. Document with a title
= The Intrepid Chronicles

This adventure begins on a frigid morning.

In Example 1, notice the empty line between the document title and the first line of prose. That empty line is what separates the document header from the document body.

Title of document

Doctypes and titles

Technically, a document title is a level 0 section title (=). The article and manpage document types (doctype) can only have one level 0 section.

The book document type permits multiple level 0 section titles. When the doctype is book, the title of the level 0 section in the header is used as the document’s title. Subsequent level 0 section titles in the document body are interpreted as part titles, unless labeled with a style.

Hide or show the document title

When converting a standalone document, the document title is shown by default. You can control whether the document title appears with the showtitle attribute. If you don’t want the title to be shown, unset the showtitle attribute using showtitle! in the document header or via the CLI or API.

When converted to an embeddable document, the document title isn’t shown by default. To show the title in the embeddable document, set showtitle in the document header or via the CLI or API. The author and revision information isn’t shown below the document title in the embeddable version of the document like it is in the standalone document, even when showtitle is set.

Reference the document title

The level 0 section title in a document’s header, that is, its title, is automatically assigned to the document attribute doctitle. You can reference the doctitle attribute anywhere in your document and the document’s title will be displayed.

Example 2. Reference the doctitle attribute
= The Intrepid Chronicles

{doctitle} begin on a frigid morning.
The document title is displayed wherever the doctitle attribute is referenced

The doctitle attribute can also be explicitly set and assigned a value using an attribute entry in the header.

title attribute

By default, the text of the document title is used as the value of the HTML <title> element and main DocBook <info> element. You can override this behavior by setting the title attribute in the header with an attribute entry. If neither a level 0 section title or doctitle is specified in the header, but title is, its value is used as a fallback document title.