-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subcategories aren't subs! #1135
Comments
Okay btw I changed the logic for it, ---
layout: page
# All the Categories of posts
---
{% include lang.html %}
{% assign HEAD_PREFIX = 'h_' %}
{% assign LIST_PREFIX = 'l_' %}
{% assign group_index = 0 %}
{% assign sort_categories = site.categories | sort %}
{% for category in sort_categories %}
{% assign category_name = category | first %}
{% assign posts_of_category = category | last %}
<div class="card categories">
<!--category -->
<div
id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom"
>
<span class="ms-2">
<i class="far fa-folder{% if posts_of_category.size > 0 %}-open{% endif %}"></i>
{% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="mx-2">{{ category_name }}</a>
<!-- posts count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{{ top_posts_size }}
{% if top_posts_size > 1 %}
{{
site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure
}}
{% else %}
{{
site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure
}}
{% endif %}
</span>
</span>
<!-- arrow -->
{% if top_posts_size > 0 %}
<a
href="#{{ LIST_PREFIX }}{{ group_index }}"
data-bs-toggle="collapse"
aria-expanded="false"
aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom"
>
<i class="fa-solid fa-angle-down"></i>
</a>
{% else %}
<span data-bs-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fa-solid fa-angle-right"></i>
</span>
{% endif %}
</div>
<!-- .card-header -->
<!-- Posts -->
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse" aria-expanded="false">
<ul class="list-group">
{% for post in posts_of_category %}
<li class="list-group-item">
<i class="fa-regular fa-file"></i>
<a href="{{ post.url | relative_url }}" class="mx-2">{{ post.title }}</a>
<span class="text-muted small font-weight-light">
{% include datetime.html date=post.date wrap='span' class='text-muted small' lang=lang %}
</span>
</li>
{% endfor %}
</ul>
</div>
</div>
<!-- .card -->
{% assign group_index = group_index | plus: 1 %}
{% endfor %} Gonna close this now. |
So this is now just having all categories as main categories? |
Like I said in #893 (comment), this is an issue of |
@NichtsHsu Ok thank you, does this require all the changes made in this commit? |
This commit only does three things:
So the answer is yes, all modifications except the |
NOTE: Before you start, the following should be completed.
master
branch.Describe the bug
Referring to this issue:
The current "categories" tab is not working as expected and showing wrong "sub category" because the generated content in _site is all main category and this line in front matter
categories: [TOP_CATEGORIE, SUB_CATEGORIE]
is also wrong and misleadingSo in the current situation to remove the confusion and misleading concept "sub category" I suggest removing the subcategory dropdown in the "categories" tab page and make them all main categories (because they are all main in _site) until introducing a real subcategory
Thanks, I hope this makes sense
The text was updated successfully, but these errors were encountered: