1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Fixed rendering of tags in search

This commit is contained in:
squidfunk 2024-09-22 12:10:08 +02:00
parent 43a22b6150
commit 06fe18af7e
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 19 additions and 15 deletions

View File

@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.56dfad97.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.d6f25eb3.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -88,16 +88,20 @@ function renderSearchDocument(
{teaser > 0 && document.text.length > 0 &&
document.text
}
{document.tags && document.tags.map(tag => {
const type = tags
? tag in tags
? `md-tag-icon md-tag--${tags[tag]}`
: "md-tag-icon"
: ""
return (
<span class={`md-tag ${type}`}>{tag}</span>
)
})}
{document.tags && (
<nav class="md-tags">
{document.tags.map(tag => {
const type = tags
? tag in tags
? `md-tag-icon md-tag--${tags[tag]}`
: "md-tag-icon"
: ""
return (
<span class={`md-tag ${type}`}>{tag}</span>
)
})}
</nav>
)}
{teaser > 0 && missing.length > 0 &&
<p class="md-search-result__terms">
{translation("search.result.term.missing")}: {...missing}