Hide the empty trending tags from panel.

This commit is contained in:
Cotes Chung 2020-06-01 22:59:09 +08:00
parent 75c57d1725
commit b28724b4d4
4 changed files with 7 additions and 3 deletions

View file

@ -45,18 +45,22 @@
{% endif %} <!-- site.data.updates --> {% endif %} <!-- site.data.updates -->
{% include trending_tags.html %}
{% if trending_tags.size > 0 %}
<div id="access-tags"> <div id="access-tags">
<h3 data-toc-skip> <h3 data-toc-skip>
{{- site.data.label.panel.trending_tags -}} {{- site.data.label.panel.trending_tags -}}
</h3> </h3>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3"> <div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% include trending-tags.html %}
{% for tag in trending_tags %} {% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} {% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a> <a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
</div> <!-- .access --> </div> <!-- .access -->

View file

@ -9,7 +9,7 @@
<div class="col-12 col-xl-11 post-content"> <div class="col-12 col-xl-11 post-content">
<div id="search-hints"> <div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4> <h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
{% include trending-tags.html %} {% include trending_tags.html %}
{% for tag in trending_tags %} {% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} {% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a> <a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>

View file

@ -65,7 +65,7 @@ const include = [
{% endfor %} {% endfor %}
/* Trending tags */ /* Trending tags */
{% include trending-tags.html %} {% include trending_tags.html %}
{% for tag in trending_tags %} {% for tag in trending_tags %}
{% capture tag_url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} {% capture tag_url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
'{{ tag_url | relative_url }}', '{{ tag_url | relative_url }}',