Improved the generation rules of Categories ID.
Avoid invalidation of icon animations for closed and opened top categories when category names contain a dot.
This commit is contained in:
parent
618ae9dcbc
commit
b3e6fc56f7
1 changed files with 24 additions and 20 deletions
|
@ -11,6 +11,8 @@ title: Categories
|
||||||
{% assign HEAD_PREFIX = "h_" %}
|
{% assign HEAD_PREFIX = "h_" %}
|
||||||
{% assign LIST_PREFIX = "l_" %}
|
{% assign LIST_PREFIX = "l_" %}
|
||||||
|
|
||||||
|
{% assign group_index = 0 %}
|
||||||
|
|
||||||
{% assign sort_categories = site.categories | sort %}
|
{% assign sort_categories = site.categories | sort %}
|
||||||
|
|
||||||
{% for category in sort_categories %}
|
{% for category in sort_categories %}
|
||||||
|
@ -36,47 +38,47 @@ title: Categories
|
||||||
<div class="card categories">
|
<div class="card categories">
|
||||||
<!-- top-category -->
|
<!-- top-category -->
|
||||||
<div class="card-header d-flex justify-content-between hide-border-bottom"
|
<div class="card-header d-flex justify-content-between hide-border-bottom"
|
||||||
id="{{ HEAD_PREFIX }}{{ category_name }}">
|
id="{{ HEAD_PREFIX }}{{ group_index }}">
|
||||||
<span>
|
<span>
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
<i class="far fa-folder-open fa-fw"></i>
|
<i class="far fa-folder-open fa-fw"></i>
|
||||||
{% else %}
|
{% else %}
|
||||||
<i class="far fa-folder fa-fw"></i>
|
<i class="far fa-folder fa-fw"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/"
|
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/"
|
||||||
class="ml-1 mr-2">
|
class="ml-1 mr-2">
|
||||||
{{ category_name }}
|
{{ category_name }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- content count -->
|
<!-- content count -->
|
||||||
{% assign top_posts_size = site.categories[category_name] | size %}
|
{% assign top_posts_size = site.categories[category_name] | size %}
|
||||||
<span class="text-muted small font-weight-light">
|
<span class="text-muted small font-weight-light">
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
{{ sub_categories_size }}
|
{{ sub_categories_size }}
|
||||||
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
|
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ top_posts_size }}
|
{{ top_posts_size }}
|
||||||
post{% if top_posts_size > 1 %}s{% endif %}
|
post{% if top_posts_size > 1 %}s{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- arrow -->
|
<!-- arrow -->
|
||||||
{% if sub_categories_size > 0%}
|
{% if sub_categories_size > 0%}
|
||||||
<a href="#{{ LIST_PREFIX }}{{ category_name }}" data-toggle="collapse" aria-expanded="true"
|
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse" aria-expanded="true"
|
||||||
class="category-trigger hide-border-bottom">
|
class="category-trigger hide-border-bottom">
|
||||||
<i class="fas fa-fw fa-angle-down"></i>
|
<i class="fas fa-fw fa-angle-down"></i>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span data-toggle="collapse" class="category-trigger hide-border-bottom disabled">
|
<span data-toggle="collapse" class="category-trigger hide-border-bottom disabled">
|
||||||
<i class="fas fa-fw fa-angle-right"></i>
|
<i class="fas fa-fw fa-angle-right"></i>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div> <!-- .card-header -->
|
</div> <!-- .card-header -->
|
||||||
|
|
||||||
<!-- Sub-categories -->
|
<!-- Sub-categories -->
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
<div id="{{ LIST_PREFIX }}{{ category_name }}" class="collapse show" aria-expanded="true">
|
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for sub_category in sub_categories %}
|
{% for sub_category in sub_categories %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
|
@ -95,5 +97,7 @@ title: Categories
|
||||||
|
|
||||||
</div> <!-- .card -->
|
</div> <!-- .card -->
|
||||||
|
|
||||||
|
{% assign group_index = group_index | plus: 1 %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue