Home

Awesome

docsite

A documentation site generator that fits Sourcegraph's needs:

Usage

go get github.com/sourcegraph/docsite/cmd/docsite
docsite -h

To use docsite for docs.sourcegraph.com, see "Documentation site" in the Sourcegraph documentation.

Checks

The docsite check command runs various checks on your documentation site to find problems:

If any problems are found, it exits with a non-zero status code.

To ignore the disconnected page check for a page, add YAML ignoreDisconnectedPageCheck: true to the top matter in the beginning of the .md file. For example:

---
ignoreDisconnectedPageCheck: true
---

# My page title

Site data

The site data describes the location of its templates, assets, and content. It is a JSON object with the following properties.

The possible values for VFS URLs are:

Templates

The templates use Go-style HTML templates.

See the following examples:

Redirects

In addition to the redirects property in site data, you can also specify redirects in a text file named redirects at the top level of the assets VFS. The format is as follows:

FROM-PATH TO-URL STATUS-CODE

For example:

# Comments are allowed
/my/old/page /my/new/page 308
/another/page https://example.com/page 308

Specifying site data

The docsite tool requires site data to be available in any of the following ways:

Development

Release a new version

  1. Build the Docker image for linux/amd64:

    docker build -t sourcegraph/docsite .
    
    # Use buildx if you're on M1
    docker buildx build --platform linux/amd64 -t sourcegraph/docsite .
    
  2. Tag and push the image to Docker Hub and GCR:

    export VERSION= # e.g. v1.9.1
    docker tag sourcegraph/docsite sourcegraph/docsite:$VERSION
    docker push sourcegraph/docsite
    docker push sourcegraph/docsite:$VERSION
    
  3. For internal Sourcegraph usage:

    1. Bump the deployed version by updating the SHA-256 image digest in all files that define sourcegraph/docsite:latest@sha256.
    2. Once the pull request is merged, wait for the Buildkite build to pass.
  4. For development, bump the version number in files that define DOCSITE_VERSION.