Account and API Keys

The keys key accepts a map of name-value pairs that specify account identifiers used for service integrations such as Google Analytics or search tools.

keys key

The keys key is optional. You define the keys key under the site key in a playbook. keys accepts a list of name-value pairs (aka subkeys) that specify account identifiers.

Example 1. antora-playbook.yml
site:
  title: Site Title
  url: https://example.org
  keys:
    name-of-account-key: 'identifier'
    google_analytics: 'XX-123456'

The value of these keys can then be accessed by a UI template from the site.keys property in the UI model. When assigned to the UI model, the name is converted to camelCase (regardless of whether words in the name are separated using hyphens or underscores). For example, you can access the keys defined in the example above as site.keys.nameOfAccountKey and site.keys.googleAnalytics, respectively.

Site keys can also be configured from the CLI.

Add a Google Analytics account

The google_analytics key assigns a Google Analytics account to the site. Setting this option implicitly enables the Google Analytics / Tag Manager embed code when using the default UI.

Example 2. antora-playbook.yml
site:
  title: Demo Docs Site
  url: https://demo.antora.org
  keys:
    google_analytics: 'XX-123456'

We recommend enclosing the value in single quotation marks (') to prevent it from being mangled by the YAML parser. The google_analytics key can also be configured from the CLI and using the GOOGLE_ANALYTICS_KEY environment variable.