Overriding HTML templates #3398
-
PreconditionsMkdocs has build in HMTL template blocks, particularly for table-of-contents (toc). I work with Mkdocs-material, so it uses inside base.html the toc template like this, which is declared here for example. Right after that line of toc-item.html i want to insert my custom socials block: {% include "partials/socials.html" %} ProblemMkdocs is made such a way, that it uses the class of nav block of secondary type(class), and also it is used for the nested secondary level navigation tab in another toc block (left sidebar). These two different blocks with similar inner nav-secondary classes you can see here: When i insert the custom block to toc.html right after md-nav__list it gets embedded in two places and ruins the layout. Solutions used
QuestionI want to insert my custom template after right side toc block, how can i determine this place specifically from templates or in another way ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Question is open yet |
Beta Was this translation helpful? Give feedback.
-
That's really a question for the Material for MkDocs discussion board, as the theme defines the HTML partials that are rendered into the final website. But anyway, the https://github.com/squidfunk/mkdocs-material/blob/929fc39dbe67dd5a2044636c81028270679d9213/material/templates/base.html#L177 So basically to focus on the
|
Beta Was this translation helpful? Give feedback.
That's really a question for the Material for MkDocs discussion board, as the theme defines the HTML partials that are rendered into the final website.
But anyway, the
toc.html
partial is included in both the content of the page and in the navigation, because toc in the navigation is being shown when the page is in mobile / portrait mode.https://github.com/squidfunk/mkdocs-material/blob/929fc39dbe67dd5a2044636c81028270679d9213/material/templates/base.html#L177
https://github.com/squidfunk/mkdocs-material/blob/929fc39dbe67dd5a2044636c81028270679d9213/material/templates/partials/nav-item.html#L124
So basically to focus on the
toc
in the content on the right side, you need to override theb…