Deploying as a Static Website

You can deploy your documentation portal as a static website.

Gramax CLI is used for generating static websites based on content created in Gramax.

Prerequisites

  • Node.js version 18 or higher (required for CLI).

  • A text editor, such as Visual Studio Code.

  • A terminal.

Quick Start

  1. Install Gramax CLI: npm install -g gramax-cli.

  2. Generate the static site: gramax-cli build --source ./content --destination ./output.

Detailed Steps

Step 1: Install Gramax CLI

Gramax CLI can be used in two ways:

  1. Without installation: Run commands using npx: npx gramax-cli <command> [options].

  2. Global installation: For frequent use, install it globally: npm install -g gramax-cli.

After installation, CLI commands are available from any directory.

Step 2. Generate the static site

To generate the site, run the following command: gramax-cli build [options].

Build options

Option

Description

Default value

--source, -s

Path to the content directory created in Gramax.

Current directory

--destination, -d

Directory where the static site will be generated.

./build

--skip-check

Skip validation before the build.

false

--force-ui-lang-sync, -l

Use the same UI language as the content language if the locale is available.

false

--features, -f

Enable experimental features as a comma-separated list.

Not set

--custom-css, -cc

Path to a CSS file to include during the build.

Not set

--docx-templates, -dt

Path or glob pattern to DOCX export templates.

Not set

--pdf-templates, -pt

Path or glob pattern to PDF export styles. Requires the export-pdf experimental feature.

Not set

--base-url

Base site URL. If set, the build also generates sitemap.xml and robots.txt.

Not set

--versions

Build the site with all catalog versions.

false

Configure additional settings

You can configure additional site settings, including indexing, metrics collection, custom styles, and the catalog logo.

  1. Use gramax.config.yaml. Create a file in the content root, add the required settings:

    build: logo: imageUrl: "https://example.com/logo.png" # See "Portal logo" linkUrl: "https://example.com" metrics: # See "Portal Web Analytics" yandex: metricCounter: 12345678 matomo: matomoSiteId: 1 matomoUrl: "https://example.com/matomo" matomoContainerUrl: "https://example.com/container" ai: # See "AI Search on a Static Site" url: "https://ai.example.com" instance: "my-static-site" token: "myPrivateToken" publicToken: "myPublicToken" forceUiLangSync: true # Match the UI language to the content language features: # Enable experimental features - filtered-catalog # Filter the catalog by content - export-pdf # Use the new PDF export
  2. Use environment variables.