Page Header
On this page, you’ll learn:
-
How to structure a valid AsciiDoc page header.
-
How to set a page title.
-
How to add metadata to a page.
-
How to set AsciiDoc’s built-in page attributes.
Header anatomy
The page header is a set of contiguous lines that start on the first line of the file. The header is separated from the page body by at least one blank line.
= Page Title (1)
First Middle Last <author@email.com> (2)
:description: A description of the page stored in an HTML meta tag. (3)
:keywords: comma-separated values, stored, in an HTML, meta, tag (4)
:page-role: tiles (5)
:sectanchors: (6)
:url-repo: https://my-git-repo.com (7)
1 | Title of the page |
2 | Author name and email address |
3 | Description attribute |
4 | Keywords attribute |
5 | A user-defined page attribute |
6 | A built-in AsciiDoc attribute |
7 | A user-defined attribute |
Each attribute entry must be entered on its own line. The header can also contain comments.
Page title
A page title is specified by one equals sign (=
), followed by one blank space, and then the text of the title.
= The title of this page
Page metadata
AsciiDoc provides several built-in attributes for defining page metadata.
Author syntax
Specifying the author or authors of a page is optional.
The author is listed on the line directly beneath the page’s title.
An optional email address or contact URL can follow an author’s name inside a set of angle brackets (< >
).
When a page has multiple authors, each author is separated by a semicolon (;
).
= Page Title
First Middle Last <author@email.com>; First Last <author@email.com>
Author names are output to the HTML <meta>
tag.
<head>
<meta charset="UTF-8">
<meta name="author" content="First Middle Last, First Last">
Whether any author information is also displayed on a published page depends on the site’s UI templates.
Asciidoctor resources
Refer to the Asciidoctor user manual for additional author attributes and methods for specifying author information.
Description syntax
If set, description
is output to an HTML <meta>
tag with the same name.
You can break long values across several lines by ending each line with a backslash \
that is preceded by a space.
= Page Title
:description: A description of the page stored in an HTML meta tag. This page is \
about all kinds of interesting things.
<head>
<meta charset="UTF-8">
<meta name="description" content="A description of the page stored in an HTML meta tag. This page is about all kinds of interesting things.">
Keywords syntax
The keywords attribute contains a list of comma-separated values that are assigned to an HTML <meta>
tag with the same name.
= Page Title
:keywords: comma-separated values, stored, in an HTML, meta, tag
<head>
<meta charset="UTF-8">
<meta name="keywords" content="comma-separated values, stored, in an HTML, meta, tag">
Built-in attributes
Antora and AsciiDoc provide built-in attributes that activate and control syntax output behavior and styles. See Page and Site Attributes to learn about the built-in Antora attributes.
If you’re not familiar with AsciiDoc attribute restrictions or operations precedence, review the attributes section of the Asciidoctor manual. |
Built-in AsciiDoc attributes are reserved attributes that have special, pre-defined behavior. Many built-in attributes also have a restricted set of accepted values.
These attributes usually do two things; they toggle a behavior on or off (boolean), and they change the generated output by accepting an alternate value or replacement content (variable).
Set and unset built-in attributes
Let’s turn on the attribute sectanchors
.
= Page Title
:sectanchors:
When turned on, sectanchors
adds an anchor to the left of each section title.
The anchor is rendered as the symbol §
.
The attribute is turned on, also known as set, by simply entering it into the header.
Built-in attributes that are on by default, like table-captions
, can be unset (turned off) with a leading or trailing !
added to its name.
= Page Title
:sectanchors:
:table-caption!:
Change a built-in attribute value
Let’s look at an example of a built-in attribute that has a default value that we want to replace with a custom value.
The label on a Note admonition is controlled by the attribute note-caption
.
This attribute is set (on) by default and has an implicit value of NOTE
.
Let’s change the value to “OPS HINT”.
= Page Title
:note-caption: OPS HINT
Now, when we create a Note admonition, its label is displayed as OPS HINT.
This is an Ops Hint. |