Include a Page
You can insert one page, or a portion of that page, into another page using the include directive.
The page-partial attribute
Before we get started, we need to talk about the page-partial
attribute.
If you plan to use a page as an include, you must define the page-partial
attribute in the header of that page, as shown here:
= Page Used as an Include
:page-partial:
Page contents.
This attribute declaration tells Antora to keep the source lines available so they can be used in an include.
Include directive structure for pages
You can include a page (or a portion of that page) into another page using either a relative path (a path relative to the current file) or the familiar resource ID syntax in the target of the include directive.
include::./relative-path.adoc[<attrlist>]
or
include::version@component:module:page$relative-path.adoc[<attrlist>]
Let’s explore this syntax.
-
On a new line, enter the name of the directive followed by two colons.
include::version@component:module:page$relative-path.adoc[]
-
Next, enter the relative path (starting with
./
) or the resource ID of the target file.A relative path must begin with
./
.include::./relative-path.adoc[]
A page’s resource ID is determined just like the coordinates in an xref. However, when used in an include directive, the resource ID must contain the
page$
family (since it supports multiple families). All other segments (component, version, and module) are optional and will inherit the context from the current file.include::version@component:module:page$relative-path.adoc[]
-
Close the directive with a set of square brackets (
[]
). The brackets may contain an optional list of attributes (i.e., attrlist) such asleveloffset
,tag
, andtags
. The attributes should be entered as key=value pairs separated by commas.include::version@component:module:page$relative-path.adoc[tag=definition]
Currently, Antora only supports filtering lines of an include by tags, not by lines.