Skip to content

How to Build a Knowledge Base with MkDocs Material: From an Empty Folder to a Site with Search and RSS

Cover: knowledge base on MkDocs Material A knowledge base does not require a backend or database. It only needs Markdown files, the MkDocs generator, and the Material theme to produce a static site with search, dark mode, and RSS, which can be hosted anywhere.

Why Use MkDocs for a Knowledge Base

When there is little content, a single notes file suffices. When there are hundreds of pages, a website with navigation, search, and structure is needed. Two main options: build it yourself or use a ready-made generator. A custom-built site involves layout, routing, search, and responsiveness. All of this is already available in MkDocs with the Material theme: - Content is plain Markdown, easy to write and edit; - Menu and sections are defined in one file mkdocs.yml; - Search, dark mode, mobile version — all out of the box; - Build process — one command, resulting in static HTML. This is sufficient for a knowledge base. This is how my project — AI Wiki — is structured: hundreds of articles in plain .md files.

Step 1. Installation and Structure

Everything is installed via pip:

pip install mkdocs-material
The basic project structure:
my-wiki/
  docs/            ← content, Markdown files
    index.md
    glossary/
    blog/posts/
  mkdocs.yml       ← config: navigation, theme, plugins
To create a new project:
mkdocs new my-wiki
After this, the docs/ folder already contains the starting index.md, and in the root — mkdocs.yml.

Step 2. Navigation in mkdocs.yml

The site menu is defined in mkdocs.yml under the nav section:

nav:
  - Home: index.md
  - Glossary: glossary/index.md
  - Blog: blog/index.md
This is the site map: anything not listed in nav does not appear in the menu, even if the file is in docs/. The theme is enabled like this:
theme:
  name: material
  language: ru
  features:
    - navigation.instant
    - search.suggest
    - search.highlight
navigation.instant makes page switching without full reload — the site feels faster. This has a nuance for custom scripts, see below.

Step 3. Plugins: Search, Tags, RSS

MkDocs is extended with plugins. Minimal set for a knowledge base:

plugins:
  - search                    # built-in search
  - tags                      # pages by tags
  - blog:                     # blog with feed and archives
      categories: false
  - rss:                      # RSS feed
      match_path: blog/posts/.*
      date_from_meta:
        as_creation: date
Tags in articles are defined in front matter (file header):
---
tags:
  - mkdocs
  - documentation
---
# Title
Rule: tags only in Latin, otherwise tag links break.

Step 4. Russian Search with lunr

The built-in MkDocs search works poorly with Russian by default. This is fixed by connecting lunr with Russian morphology:

extra_javascript:
  - javascripts/lunr.min.js
  - javascripts/lunr.stemmer.support.js
  - javascripts/lunr.ru.js
  - javascripts/lunr.multi.js
And in the search script, the index is built as lunr.multiLanguage('en', 'ru'). Without this, Russian words are searched incorrectly. If you add custom scripts — remember about navigation.instant: pages switch without reload, so DOMContentLoaded does not work on transitions. Use document$.subscribe(fn) — it is called on load and on each transition.

Step 5. Build and Deploy

Local build into the site/ folder:

mkdocs build --strict
--strict turns warnings into errors: a broken link or unclosed tag will not pass the build, and a broken site will not go to production. Next, the site/ folder can be uploaded to any hosting: GitHub Pages, Netlify, or regular FTP. Detailed analysis of options — in the guide on deploying a static site.
flowchart LR
    A[Markdown files<br>docs/] --> B[mkdocs build]
    B --> C[Static site<br>site/]
    C --> D[Hosting<br>FTP / Pages / Netlify]

What in the End

From an empty folder, a full-fledged site is produced: navigation, search with Russian language, blog with RSS, tags, dark mode. All this without a backend or database — only Markdown and one config. This is how AI Wiki is structured: the same scheme grew into a portal with hundreds of articles. If you are interested in how it looked in practice — with pitfalls and solutions, take a look at the case.

See Also