Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a landing page to a mkdocs doc site using mkdocs-material?

I'm trying to create a landing page similar to how mkdocs-material's doc site (https://squidfunk.github.io/mkdocs-material/) has. I am using mkdocs-material for my docs site.

like image 861
Farhan Sheik Avatar asked Oct 24 '25 11:10

Farhan Sheik


1 Answers

How?

You will need to use a custom template for a specific page (e.g. home page) and providing the implementation for this template. So for the home page you are looking for this file: .overrides/home.html. You'll want to copy it over to your own overrides directory or take my example as reference. Make sure you've set your custom_dir in mkdocs.yml:

 theme:
   custom_dir: material
 ...

In the front matter of your index.md, you need to specify the template to use:

---
title: Title
template: home.html
---

Important Consideration

You need a newline at the end of your md file. If you don't have one, the content will not display. I guess it's processed as having null content if you don't include the newline.

Ref Links

  • https://github.com/squidfunk/mkdocs-material/issues/1996.
  • https://github.com/binbashar/le-ref-architecture-doc.
like image 125
Exequiel Barrirero Avatar answered Oct 27 '25 00:10

Exequiel Barrirero