Override the header to add a custom button to the end of nav #4612
-
Beta Was this translation helpful? Give feedback.
Answered by
santaimpersonator
Jan 31, 2023
Replies: 2 comments 4 replies
-
You should override mkdocs-material/src/partials/tabs.html Lines 34 to 36 in 018e5f8 Then, add the necessary CSS to align right (e.g. via |
Beta Was this translation helpful? Give feedback.
0 replies
-
Update:
I actually had to make the modification before the loop to get it to work. (It wouldn't work after the loop because of the unordered list element that is used.)
Modification to <div class="md-tabs__inner md-grid">
<!-- Adds tab on right side of header -->
{% if "<file_name>.md" %}
<ul class="md-tabs__list" style="float: right;">
<li class="md-tabs__item">
<a href="<relative page link>" class="md-tabs__link">
<tab title>
</a>
</li>
</ul>
{% endif %}
<!-- Original tabbed sections -->
<ul class="md-tabs__list">
{% for nav_item in nav %}
{% include "partials/tabs-item.html" %}
{% endfor %}
</ul>
</div> |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
squidfunk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update:
The example below was working with mkdocs-material (v8.5.6). I just upgraded to v9.0.9 and now it doesn't 😅29
was updated (not tested - using Insiders)23
and34
(works if you include all three line changes)I actually had to make the modification before the loop to get it to work. (It wouldn't work after the loop because of the unordered list element that is used.)
tabs.html
file in the/docs/overrides/partials/
directory, as specified in the documentation<relative page link>
- Replace with the generated page link for tab<tab title>
- Replace with t…