mkdocs
¶
These are notes on mkdocs
from deploying a mkdocs
site for my notes.
mkdocs
is a Python-based tool used to build static websites, geared towards
technical documentation.
Setting up MkDocs¶
These are setup notes for a MkDocs website.
-
For local testing, use a virtual environment.
sudo apt-get install -y python3.10-venv # to get the venv module sudo apt-get install -y python3.10-venv --fix-missing # if install doesn't work
- This is a Debian-based install. For RedHat-based distros, the
venv
module should be available as long aspython3
is installed.
- This is a Debian-based install. For RedHat-based distros, the
-
Once the Python
venv
module is installed, create the virtual environment and activate it by sourcing thevenv/bin/activate
script.
-
Verify you're in the virtual environment.
-
Install
mkdocs
and a theme formkdocs
.
-
Initialize the
mkdocs
project.
- This initializes a new mkdocs project in the current directory (
.
). - It creates a baseline
mkdocs.yml
file and adocs/
directory with anindex.md
file.
- This initializes a new mkdocs project in the current directory (
-
Add any markdown files you want to serve via the docs site into the
docs/
directory.
-
Add all files to the
mkdocs.yml
file in thenav
section to serve them.
MkDocs Project Structure¶
In the root of the repo, you need a docs/
directory.
You also need a mkdocs.yml
file in the repo root.
The directory structure of my notes directory is fine for mkdocs, but it all needs to
be in the docs/
directory instead of the root.