MKDocs
2 minute read
MKDocs is a static-site generator that converts Markdown source files into fully formed websites.
Check version
Use --version
to display the current MkDocs version:
$ mkdocs --version
Hide footer ad
Early versions of MkDocs include a small “ad” in the footer of your webpages (“Documentation built wwith MKDocs”).
You can hide this by adding a CSS rule to hide the message or by removing it from your site’s template.
Hide with CSS
To hide the ad using CSS:
-
In your project’s
/docs/
folder, add the following rule to a custom style sheet:footer :last-child { display: none; }
-
Verify that your custom style sheet is declared in your site’s project configuration (
mydocs.yml
)site_name: My example site exta_css: - hidefooter.css
Here, we assume your custom CSS file is named
hidefooter.css
.
If you’re working with an earlier version of MKDocs, you may need to tweak the CSS rule. In version v0.15.x, for example, MKDocs placed its ad in a <center>
element (now deprecated).
To hide the footer in this version:
center { display: none; }
Update template
You can also update the template to remove the ad entirely:
-
Install a copy of the basic theme into a your project.
-
Update
mkdocs.yml
to refer to your new theme:theme_dir: <custom-template>
-
Update
base.html
to remove the “Built with” line (line 189 as of this writing). -
Save, build, and deploy as usual.
Customize templates
MKDocs uses Jinja2 as its templating engine. To learn more, see:
- MkDocs: “Developing themes
- Jinja2 docs
Vital statistics
- 8 May 2024: Rewritten and updated for site revamp
- 15 March 2017: First post