Setting Up a MkDocs Project from Scratch¶
This guide walks you through installing MkDocs and its dependencies, creating a new project, and building your documentation.
1. Install Required Packages¶
Ensure Python3, pip, and the virtual environment module are installed:
Install MkDocs, the Material theme, and required extensions:
Note: Some systems also offer MkDocs via apt:
2. Create a New MkDocs Project¶
Create a new project directory (replace my-mkdocs-project
with your project name).
If you run into permission issues, ensure the directory is writable or run as a user with proper privileges.
This creates a mkdocs.yml
file and a default docs/
directory with an index.md
.
3. Customize Your MkDocs Configuration¶
Edit mkdocs.yml
to suit your needs. For example, you might use the Material theme:
site_name: BT Docs
theme:
name: material
custom_dir: overrides
logo: BT-PROUD-face.png
favicon: BT-PROUD-face.png
plugins:
- search:
indexing: 'full'
extra:
generator: false
You can further adjust navigation, markdown extensions, and plugins as needed.
4. Build Your Documentation¶
To build your site:
This generates a static site in the site/
directory.
5. Run Your Documentation¶
To make it available on all devices on your network then you can run
Then openhttp://<host-ip>:8000
in your browser.
(Less likely to be applicable) To preview locally (given that you are using the internet on that machine or on a browser on the host machine):
Then open http://127.0.0.1:8000 in your browser.