ARTICLE - Dev Stack & Tools

Building and Publishing a Documentation Site

Choose a docs site around maintainers, versions and access. Generators build files; hosting publishes them, but validation and rollback still need clearly assigned team owners.

2026-11-26 16IDC Original 8 views
Advertisement

Product documentation needs searchable pages and stable links, as well as someone responsible for changes. A static generator and hosting fit a team comfortable maintaining Markdown in Git; a hosted documentation platform may suit browser-based collaboration. In either case, check exports, access controls and the ability to preserve old URLs.

Choose Who Owns Content and Publishing

A generator and a hosting service are complementary: the former turns source files into a site, while the latter can build and distribute it. The comparison follows official documentation checked on 2026-11-28; verify plugins, plan features and permissions for the actual configuration. See also GitBook Git sync and Mintlify OpenAPI setup.

Route Content and build Check before publishing
MkDocs Python and Markdown generate static files, with search by default The team maintains dependencies, version archives and hosting
Docusaurus Node.js generates a site with documentation versioning and MDX Maintain Node dependencies and version snapshots; choose hosting separately
GitBook Hosted documentation and browser editing Check collaboration permissions, exports and private publishing against the plan
Mintlify Hosted documentation that can use OpenAPI content Check repository workflows, API reference, permissions and export scope

A generator does not make operation free: build infrastructure, hosting traffic, search or plugins can cost money. For a hosted platform, inspect seat, site, access-control and overage terms. Export a sample containing images and navigation to find out what a migration would require rebuilding.

From Markdown to a Published Site

The diagram separates the build from publication: a successful build produces files, but does not prove that the target URL, permissions or search index work.

Documentation publishing flow Source files Build checks Publish files Verify access Check files and anchors Check paths, search, access Source: responsibilities of a static generator and host
Figure 1: Documentation publishing flow (Source: responsibilities of a static generator and host)

Build and Check Links with MkDocs

This example uses MkDocs 1.6.1 on a machine with Python 3 and network access to install packages. Run it in an empty working directory, not an existing project. Do not commit the virtual environment or generated site/ as source; production projects should also pin complete dependencies and review upgrades.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install 'mkdocs==1.6.1'
mkdocs new docs-site
cd docs-site

You should see mkdocs.yml and docs/index.md inside docs-site. If installation fails, check the Python version and package source. If the directory exists, choose an empty location instead of overwriting content.

Replace mkdocs.yml with the configuration below, then add guide.md under docs/ with a heading and content. site_url is an example of the final URL: replace it before publishing, retaining the subpath and trailing slash when applicable.

site_name: Example Docs
site_url: https://docs.example.com/
nav:
  - Home: index.md
  - Guide: guide.md
validation:
  links:
    not_found: warn
    anchors: warn

You should see the configuration accepted and the home and guide pages generated by the strict build below. The configuration warns about missing documents and anchors; --strict makes warnings fail the build. It does not check every external link, runtime link or arbitrary HTML. See the MkDocs configuration documentation.

mkdocs build --strict
mkdocs serve -a 127.0.0.1:8000

You should see site/index.html and site/guide/index.html after a successful default build. Open http://127.0.0.1:8000/, check navigation, content and search, then press Ctrl+C to stop the preview. If site_url includes a subpath, include it in the preview address too. On a test branch, temporarily add a link to a missing Markdown file or anchor and build again: expect a warning and a nonzero exit; fix it and rebuild. This does not verify external site availability.

Publish, Verify and Roll Back

For static hosting with Netlify, connect the repository and put mkdocs==1.6.1 in requirements.txt in the site base directory so the build environment installs it. Set the build command to mkdocs build --strict and the publish directory to site. If the project is not at the repository root, set the base directory first; the publish directory is relative to it. See Netlify build configuration and dependency management.

Check the home page, nested pages, anchors and search on a deploy preview before publishing production. For a subpath, check site_url, the host's path mapping and actual asset requests. A pull-request build can catch issues early, but blocking a merge also requires repository branch protection; see the website CI/CD pipeline guide.

Retain a working artifact and its source revision. If a Netlify release fails, select Publish Deploy on a retained successful deploy; then fix the source and rebuild so the next automatic publish does not reintroduce the fault. Rehearse restoring a complete previous artifact on other hosts. Restoring site files does not automatically undo DNS or access changes. See Netlify deploy management.

Limitations

When old documentation must remain online, agree on retention, URLs and ownership first. Docusaurus npm run docusaurus docs:version 1.0 creates a documentation snapshot, version list and sidebar. The latest release and current development version have different default paths, so do not assume every version uses the same prefix. Commit or back up sources first, then inspect old links and build; see Docusaurus versioning. The MkDocs example covers one version; multiple versions require a separate publishing approach.

Hidden navigation is not access control once static files are public. Private docs need authentication at the host, tested for logged-out visitors across previews, assets and search indexes. Do not put secrets or unpublished documents in a public repository or build artifact.

FAQ

What should I check when the build succeeds but the published page returns 404?

Check the build and publish directories first. Verify the source revision and that the publish directory points to site, not the source directory. If the home page works but nested pages or assets fail, inspect subpath mapping, site_url and hosting rules; redeploy and visit the failing URL directly.

Does a strict MkDocs build find every broken link?

No. The example promotes warnings for recognized missing documents and anchors to build failures, but it does not guarantee checks of external sites, runtime links or all HTML. Check important external URLs separately and inspect the preview before publication. Test critical navigation in the deployed site as well.

How can I avoid breaking old docs when upgrading the generator?

Pin dependencies and upgrade on a separate branch, building every version that must remain available. Compare navigation, anchors, search and important old URLs. Keep the prior dependency set and deployable artifact; restore the working deployment first if the release fails, then investigate plugin or routing changes.

Community & Resources

Original source: 16IDC Original ↗