Skip to content

Material for MkDocs

Write your documentation in Markdown and create a professional static site for your Open Source or commercial project in minutes – searchable, customizable, more than 60 languages, for all devices.

Quick start

Material for MkDocs can be installed with pip:

pip install mkdocs-material

Add the following lines to mkdocs.yml:

theme:
  name: material

Template Page

If you're using theme extension and created a new page template in the overrides directory, you can enable it for a specific page. Add the following lines at the top of a Markdown file:

---
template: custom.html
---

# Page title
...

Template 를 사용하여 Redirect Page 만들기

mkdocs.yml 파일에 다음과 같이 custom_dir 추가:

theme:
  name: material
  custom_dir: overrides

overrides/redirect.html 파일:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="canonical" href="{{ page.meta.redirect }}">
  <title>{{ page.meta.title }}</title>
  <meta http-equiv="refresh" content="0; url={{ page.meta.redirect }}" />
  <script>
    var anchor = window.location.hash.substr(1);
    location.href = "{{ page.meta.redirect }}" + (anchor ? "#" + anchor : "");
  </script>
</head>
<body>
  <p>You're being redirected to a <a href="{{ page.meta.redirect }}">new destination</a>.</p>
</body>
</html>

Redirect 하고싶은 Markdown 파일:

---
date: '2023-02-01'
redirect: /Linear_equation
template: redirect.html
title: "1차방정식"
---

# ...

주의할 점은 Redirect 주소는 mkdocs 로 부터 경로를 다시 할당받지 못한다. 따라서 직접 정확한 주소를 입력해야 한다.

See also

Favorite site