DEV Community


Posted on

Mkdocs: Setting up mkdocs.yml

Setting up mkdocs.yml file is needed in the way to deploy a Mkdocs project, in this file we can set a lot of different values related to the theme, add custom CSS, navigation index, social network and more other things.

Let start with basic parameters:

site_name: '<Site Name>'
site_description: '<Site Description>'
site_author: '<user>'
site_url: 'https://<user><git_repo>'
copyright: "copyright &copy; 202X <user>"

repo_url: '<user>/<git_repo>'
edit_uri: ""
Enter fullscreen mode Exit fullscreen mode

Next we could add some social networks that will be show in the Mkdocs project:

    - icon: fontawesome/brands/github
    - icon: fontawesome/brands/dev
Enter fullscreen mode Exit fullscreen mode

These last two parameter blocks enable some basic functionalities and behaviors. But also we could manage some advanced things about the theme.

Themes can be built-in or custom. Im using a built-in one, Material.

To add this theme, I followed the Material docs and set up the following parameters:

  name: material
  logo: img/logo.png
  favicon: img/favicon.png
  language: en
    scheme: slate
    primary: deep purple
    accent: deep purple
    repo: fontawesome/brands/github
Enter fullscreen mode Exit fullscreen mode

Last step is to set Navigation, where I added a plugin (mkdocs-literate-nav). With this plugin I could remove "nav" settings from mkdocs.yml file, add some "" files on each directory adding this block:

  - literate-nav:
Enter fullscreen mode Exit fullscreen mode

A file must exist in each folder, will be automatically detected and should have the following format:

* [Klaatu Barada Nitko!](
* [Code](code/)
* [Linux](linux/)
* [Databases](databases/)
* [Cloud](cloud/)
* [Containers](container/)
* [Security](security/)
* [DevOps](devops/)
* [Monitoring](monitoring/)
* [Bookmarks](
* [About](
Enter fullscreen mode Exit fullscreen mode

That's it. Enjoy!

Top comments (0)