Adding the Material Theme
Adding the Material Theme to the default MkDocs website
To add the Material theme to the default MkDocs website, you can follow these instructions:
- Update
mkdocs.ymlConfiguration File: - If you haven't already created a
mkdocs.ymlfile in your MkDocs project directory, create one. - Open the
mkdocs.ymlfile in a text editor. -
Add or update the
themefield in the configuration file to use the Material theme:theme: name: material -
(Optional) Customize Material Theme:
- You can further customize the Material theme by adding additional configuration options to the
mkdocs.ymlfile. For example:
site_name: "OVI-GC Knowledge Base"
theme:
name: material
palette:
primary: deep-orange # Deeper Orange
accent: deep-purple # Medium to Dark Purple
- Serve Your MkDocs Site:
- Save the changes to the
mkdocs.ymlfile. - Open a command prompt or terminal window.
- Navigate to your MkDocs project directory.
- Run the following command to build and serve your MkDocs site locally:
python -m mkdocs serve
- This command will start a local web server, and you can view your MkDocs site with the Material theme applied by navigating to
http://127.0.0.1:8000in your web browser.
Note: The webserver automatically updates content upon detecting changes. If an error occurs, it will display an error message in the command line until resolved. Correcting any syntax problems in the file and saving it will trigger the webserver to reload automatically.