Include a Page

In Antora, the AsciiDoc include directive has been configured to include another page or portion of a page into the current page. You can include a page from anywhere in the site, including pages from other docs components.

AsciiDoc include directive

Example 1 shows the structure of an include directive with a page’s fully qualified resource ID.

Example 1. Include directive and resource ID syntax
include::version@component:module:page$page-filename.adoc[]

Let’s break down the AsciiDoc syntax and resource ID coordinates you need to include a page resource into a page.

The steps below assume that the target page and current page belong to the same component version and module, so only the page$ and resource coordinates of the target page resource are entered in the resource ID.

  1. On a new line, enter the name of the directive followed by two colons, include::.

    include::
  2. Enter the resource ID of the target page file. The resource ID must specify the page$ family coordinate since the include directive is also used to insert files from other families.

    include::page$page-filename.adoc
  3. Close the directive with a set of square brackets ([]).

    include::page$page-filename.adoc[]
  4. The brackets can contain an optional list of attributes. The attributes are entered as key-value pairs separated by commas.

    include::page$page-filename.adoc[attribute,attribute]

Antora supports filtering the lines of an include file by either line numbers using the lines attribute or tags using the tag or tags attributes. Filtering by line numbers takes precedence. See the Asciidoctor documentation for full details of the lines and tag or tags syntax.

Include a page using a relative path

  1. On a new line, enter the name of the directive followed by two colons.

    include::
  2. Next, enter the relative path of the target page in the target slot. A relative path include is resolved from the current page (not the root of the pages family). The relative path must be prefixed with ./.

    include::./relative-page-filename.adoc[]
    You may find that the relative path works without this prefix, but that could change in the future.
  3. Close the directive using a set of square brackets ([]).

    include::./relative-page-filename.adoc[]
  4. The brackets may contain an optional list of attributes. Attributes are entered as key-value pairs separated by commas.

    include::./relative-page-filename.adoc[attribute,attribute]

    All the attributes (e.g., lines, tags, leveloffset, indent) on the include directive are supported.