Simplified trending tags structure.

This commit is contained in:
Cotes Chung 2019-10-29 17:05:28 +08:00
parent 15a2a98e05
commit 91c7fbe30a
2 changed files with 24 additions and 22 deletions

View file

@ -21,32 +21,34 @@
{% endfor %} {% endfor %}
{% if lastmod_list.size > 0 %} {% if lastmod_list.size > 0 %}
<div id="access-lastmod" class="post mb-4""> <div id="access-lastmod" class="post mb-4"">
<h3 data-toc-skip> <h3 data-toc-skip>
{{ site.data.label.panel.lastmod }} {{- site.data.label.panel.lastmod -}}
</h3> </h3>
<ul class="post-content pl-0 pb-1 ml-1 mt-2"> <ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% assign MAX_SIZE = 5 %} {% assign MAX_SIZE = 5 %}
{% assign sum = 0 %} {% assign sum = 0 %}
{% assign lastmod_list = lastmod_list | sort | reverse %} {% assign lastmod_list = lastmod_list | sort | reverse %}
{% for item in lastmod_list %} {% for item in lastmod_list %}
{% assign index = item | split: "::" | last | plus: 0 %} {% assign index = item | split: "::" | last | plus: 0 %}
{% assign post = site.posts[index] %} {% assign post = site.posts[index] %}
<li><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></li> <li><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></li>
{% assign sum = sum | plus: 1 %} {% assign sum = sum | plus: 1 %}
{% if sum >= MAX_SIZE %} {% if sum >= MAX_SIZE %}
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div><!-- #panel-update --> </div><!-- #access-lastmod -->
{% endif %} {% endif %}
<div id="access-tags"> <div id="access-tags">
<h3 data-toc-skip>
{{ site.data.label.panel.trending_tags }} <h3 data-toc-skip>
</h3> {{- site.data.label.panel.trending_tags -}}
<div class="d-flex flex-wrap mt-2 pb-1 pr-3"> </h3>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% capture tags_array %} {% capture tags_array %}
{% for tag in site.tags %} {% for tag in site.tags %}
{{ tag[1] | size }}:{{ tag[0] | replace: ' ', '-' }} {{ tag[1] | size }}:{{ tag[0] | replace: ' ', '-' }}
@ -57,7 +59,6 @@
{% assign count = 0 %} {% assign count = 0 %}
{% assign trends = tags_array | split: " " | sort | reverse %} {% assign trends = tags_array | split: " " | sort | reverse %}
<div>
{% for trend in trends %} {% for trend in trends %}
{% assign count = count | plus: 1 %} {% assign count = count | plus: 1 %}
{% assign tag = trend | split: ":" | last %} {% assign tag = trend | split: ":" | last %}
@ -66,19 +67,20 @@
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div>
</div> </div> <!-- div.d-flex.flex-wrap -->
</div><!-- #panel-tags -->
</div>
{% if page.layout == 'post' and site.toc and page.toc %} </div> <!-- #access-tags -->
<div id="toc-wrap" class="pl-0 pr-4">
</div> <!-- .access -->
{% if page.layout == 'post' and site.toc and page.toc %}
<div id="toc-wrap" class="pl-0 pr-4">
<h3 data-toc-skip class="pl-3 pt-2"> <h3 data-toc-skip class="pl-3 pt-2">
{{- site.data.label.panel.toc -}} {{- site.data.label.panel.toc -}}
</h3> </h3>
<nav id="toc" data-toggle="toc"></nav> <nav id="toc" data-toggle="toc"></nav>
</div> </div>
{% endif %} {% endif %}
</div> <!-- #panel-wrap --> </div> <!-- #panel-wrap -->

View file

@ -431,7 +431,7 @@ footer .license a {
border: 1px solid #e9ecef; border: 1px solid #e9ecef;
border-radius: .8rem; border-radius: .8rem;
padding: .3rem .5rem; padding: .3rem .5rem;
margin-bottom: .3rem; margin: 0 .35rem .5rem 0;
} }
#access-tags .post-tag:hover { #access-tags .post-tag:hover {