How to use custom HTML/Jinja2 template per page
mkdocs-material handles template
YAML frontmatter property. For instance, we have a templates/announce.html
template file which we want to use on this page. To use it, we can write:
our_page.md
---
template: announce.html
---
Markdown content…
mkdocs-material:template
RDF property
Alternatively, we can state the following anywhere in the site.
material/template.yaml
$id: local:material/template.md
mkdocs-material:template: announce.html
Assign custom template to multiple pages at once
Use the power of OWL.
$id: PageWithCustomTemplateClass
owl:equivalentClass:
$type: owl:Restriction
owl:onProperty:
$id: mkdocs-material:template
owl:hasValue:
$id: custom_template.html
Then, you need to ensure that each page in question has PageWithCustomTemplateClass
assigned. This can be done via $type
declaration or perhaps with more OWL magic.