MkDocs logo
Documentation Platforms

MkDocs AI Integration

AI answers for MkDocs and Material for MkDocs sites

What is it?

About MkDocs

MkDocs is a Python-based static site generator for project documentation. The Material for MkDocs theme is widely used in open-source and enterprise projects to produce professional documentation from Markdown files.

Integration capabilities

How BeforeQuery works with MkDocs

Everything you can do once the MkDocs integration is connected.

Sitemap-aware discovery

BeforeQuery reads the MkDocs-generated sitemap.xml to discover all pages, including those in nested nav sections.

Clean content extraction

The crawler strips Material for MkDocs's navigation, sidebar, and footer, extracting only the documentation content for indexing.

Multi-language support

Index MkDocs sites with multiple language variants. BeforeQuery tracks each language path separately.

Deploy hook integration

Trigger a BeforeQuery sync from your CI/CD pipeline after mkdocs build and deploy to keep the index current.

Setup

How to connect MkDocs

  1. Step 01

    Enter your MkDocs site URL in BeforeQuery. The crawler will use the sitemap.xml to index all pages.

  2. Step 02

    Review the crawled page list and configure any URL exclusions for pages you do not want indexed.

  3. Step 03

    Add the BeforeQuery widget script to your MkDocs custom_html overrides (overrides/main.html) to embed AI chat.

MkDocs — Frequently Asked Questions

Common questions about connecting BeforeQuery to MkDocs.

Override the main.html template in your MkDocs project's overrides directory and add the BeforeQuery widget script tag inside the extra_javascript block or directly in the HTML. The widget will appear on every page of your MkDocs site.
Yes. BeforeQuery can index each language variant of your MkDocs site separately and track them as distinct sources. This ensures users asking questions in a specific language context get answers from the correct language version of your docs.
Yes. BeforeQuery's crawler identifies and strips navigation sidebars, headers, and footers from Material for MkDocs pages, indexing only the actual documentation content. This prevents navigation labels from polluting search results.
Add a curl call to the BeforeQuery knowledge base sync API endpoint in your CI/CD pipeline after mkdocs build completes. BeforeQuery performs an incremental sync, only re-processing pages whose content has changed since the last index.
Yes. Configure URL exclusion patterns in your BeforeQuery source settings to skip pages you do not want in the knowledge base. You can also use MkDocs's exclude_docs option to prevent certain files from appearing in the generated sitemap.

Ready to connect MkDocs?

Start free. No credit card required. Connect your first integration in under 5 minutes.