Set up a local docs dev environment
Follow these steps to build and preview the docs site on your own machine. Once it is running, you can edit content and see your changes live.
Prerequisites
The site is built with the Hugo static site generator. Install Hugo version 0.145.0 or later:
brew install hugoFor other platforms, see
Hugo installation.
You also need git and make.
Clone the repository
Clone
unionai/unionai-docs to your machine:
git clone https://github.com/unionai/unionai-docs.git
cd unionai-docsContent lives in the content/ folder as Markdown files.
The hierarchy of files and folders under content/ maps directly to the URL and navigation structure of the site.
Initialize the submodules
The docs repository uses two Git submodules that you must initialize before the first build:
unionai-docs-infra/holds the shared build infrastructure (Hugo configuration, layouts, themes, and build tools).unionai-examples/holds the runnable example code that pages embed.
Initialize the build infrastructure:
make init-infraThen initialize the examples:
make init-examplesTo update the examples submodule to its latest main later, run make update-examples.
Configure the live preview
Copy the sample local configuration file at the root of the repository to hugo.local.toml:
cp hugo.local.toml~sample hugo.local.tomlThis file controls the development preview and is not committed.
By default it displays the flyte variant with the show_inactive, highlight_active, and highlight_keys flags enabled.
Start the live preview
Start the development server:
make devThis builds the site and launches a local server at http://localhost:1313.
Open that URL in your browser and leave the server running.
As you edit content, the preview reloads automatically to reflect your changes.
Development settings
Adjust the preview by editing hugo.local.toml. Save the file and the browser refreshes automatically.
| Setting | Effect |
|---|---|
variant |
The variant to display (flyte or union). This is the “active” variant. |
show_inactive |
If true, also shows content that does not match the active variant, so you can see every variant at once. |
highlight_active |
If true, highlights the active variant’s content to distinguish it from content common to all variants. |
highlight_keys |
If true, highlights
key replacements and their values. |
For more on variants, see Variants.
Build the production site
To build the site the way the production pipeline does, run:
make distThis builds every variant and writes the result to the dist/ folder.
To build and validate a single variant, run make variant VARIANT=union (or VARIANT=flyte).
Serve the production build locally to check it:
make serveThis serves the dist/ folder at http://localhost:9000.
To use a different port, pass PORT:
make serve PORT=4444For production build details and troubleshooting, see Production builds and troubleshooting.
Next steps
- Author content with Markdown, shortcodes, and variants.
- Follow the writing guidelines so your docs match the rest of the site.
- Submit your contribution as a pull request.