Skip to content

Latest commit

 

History

History
117 lines (81 loc) · 5.02 KB

README.adoc

File metadata and controls

117 lines (81 loc) · 5.02 KB

Couchbase Documentation Site

This is the Antora playbook project (aka site build) for the Couchbase documentation site published at docs.couchbase.com.

Prerequisites

You must have Node.js 16 installed to generate the site.

node -v

If that command does not report a version that is 16 or greater, head over to nodejs.org to download the latest LTS release of Node.js.

Playbook

The playbook, defined in the playbook file antora-playbook.yml, configures the build for this site. The playbook specifies the content sources (repository and branches), site URL, UI bundle URL, global AsciiDoc attributes, and Asciidoctor extensions.

The production site is built for each change to the master branch. A deploy preview of the site is also published for each pull request, though without any of the private content sources (unless the pull request comes from a trusted source). The configuration for the deploy preview build is located in the netlify folder.

If you’re building a local version of the Couchbase docs for testing, and want a reduced-scope playbook that just builds Server docs with the components that you are editing locally, here is an SDK-based playbook file — use it as a basis for your own local playbook.

Home Docs Component

The home/ directory in this repository contains the source for the Home documentation component. All other content is sourced from separate repositories and branches.

Custom Asciidoctor Extensions

The custom extensions in the lib/ directory process the manpage macro (Couchbase CLI and Backup components), Swagger UI macro, and multi-row table headers.

File Watcher and LiveReload

This repository contains a script that watches .adoc and antora.yml files in the author workspace (as defined by local-antora-playbook.yml) and triggers a new Antora build when it detects changes to those files. The script also starts a web server and can use LiveReload to reload the browser tab after the Antora build completes. To use the script, run the following.

  1. Install dependencies.

    $ npm ci
  2. If you’re using Chrome, install the LiveReload chrome extension. Firefox has built-in support for LiveReload.

  3. Start the build.

    $ LIVERELOAD=true npx gulp

    The build first generates the site using Antora, analgous to the npx antora local-antora-playbook.yml command. It then serves the files in the output directory using a local web server.

    The web server’s host URL is printed to the console after the watch task completes.

    [17:43:27] Starting server...
    [17:43:27] Documentation Site Preview started http://localhost:5000
    [17:43:27] LiveReload started on port 35729
    [17:43:27] Running server
    Tip
    To skip the initial build, use npx gulp serve as the Gulp command.
  4. The console output will print status information every time a change is detected.

    [17:33:59] Starting 'generate'...
    [17:34:02] Finished 'generate' after 3.35 s
  5. Make changes to your AsciiDoc files locally. The browser tab should automatically reload after a short while.

  6. Use Ctrl+C to stop the process.

Reference Validation

Reference validation, which covers xrefs, includes, and images, is performed automatically when Antora runs. The validation errors will be shown in the log output.

Currently, validation is not enforced, meaning the build will not fail if an invalid reference is detected.

Reading the Log Output

If there are reference violations (e.g., broken xrefs), a report of those violations will be printed to the terminal or CI log. Here’s an excerpt from that report:

[03:39:51.926] ERROR (asciidoctor): target of xref not found: csharp:gs-prereqs.adoc
    file: modules/csharp/pages/querybuilder.adoc
    source: https://github.com/couchbaselabs/docs-couchbase-lite (refname: release/3.0)
[03:26:50.579] ERROR (asciidoctor): target of xref not found: server:fts:fts-using-analyzers.adoc#token-filters
    file: docs/public/modules/clusters/pages/search-service/create-full-text-indexes.adoc
    source: https://github.com/couchbasecloud/couchbase-cloud (refname: main, start path: docs/public)

Each message shows the repository source, the refname, and the path from the root of that repository.

Contributing

To learn how to use the playbook and generate the docs site locally, see our contributing guide.

License

Couchbase Server Documentation © 2024 by Couchbase Inc. is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.

See the LICENSE file or the Creative Commons CC BY-NC-SA 4.0 license page for details.