Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
yulmwu committed Oct 24, 2024
1 parent ac1b618 commit 82affcc
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 432 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
theme: jekyll-theme-chirpy
remote_theme: cotes2020/jekyll-theme-chirpy

baseurl: ""
baseurl:
lang: en
timezone: Asia/Seoul

Expand Down
57 changes: 24 additions & 33 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,39 @@

<footer
aria-label="Site Info"
class="
d-flex flex-column justify-content-center text-muted
flex-lg-row justify-content-lg-between align-items-lg-center pb-lg-3
"
class="d-flex flex-column justify-content-center text-muted flex-lg-row justify-content-lg-between align-items-lg-center pb-lg-3"
>
<p>
{{- '©' }}
<time>{{ 'now' | date: '%Y' }}</time>

{% if site.social.links %}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
{% else %}
<em class="fst-normal">{{ site.social.name }}</em>.
{% endif %}

{% if site.data.locales[include.lang].copyright.brief %}
<span
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ site.data.locales[include.lang].copyright.verbose }}"
>
{{- site.data.locales[include.lang].copyright.brief -}}
</span>
{% if site.social.links %} {{ site.social.name }}. {% else %}
<em class="fst-normal">{{ site.social.name }}</em>. {% endif %} {% if
site.data.locales[include.lang].copyright.brief %}
<span
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ site.data.locales[include.lang].copyright.verbose }}"
>
{{- site.data.locales[include.lang].copyright.brief -}}
</span>
{% endif %}
</p>

<p>
{%- capture _platform -%}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
{%- endcapture -%}

{%- capture _theme -%}
<a
data-bs-toggle="tooltip"
data-bs-placement="top"
title="v{{ theme.version }}"
href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank"
rel="noopener"
>Chirpy</a>
{%- endcapture -%}

{{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
{%- endcapture -%} {%- capture _theme -%}
<a
data-bs-toggle="tooltip"
data-bs-placement="top"
title="v{{ theme.version }}"
href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank"
rel="noopener"
>Chirpy</a
>
{%- endcapture -%} {{ site.data.locales[include.lang].meta | replace:
':PLATFORM', _platform | replace: ':THEME', _theme }}
</p>
</footer>
228 changes: 99 additions & 129 deletions _layouts/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,136 +3,106 @@
# 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 %}
{% assign first_post = posts_of_category | first %}

{% if category_name == first_post.categories[0] %}
{% assign sub_categories = '' | split: '' %}

{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% if second_category %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% endif %}
{% endfor %}

{% assign sub_categories = sub_categories | sort %}
{% assign sub_categories_size = sub_categories | size %}

<div class="card categories">
<!-- top-category -->
<div
id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom"
{% 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 %} {% assign
first_post = posts_of_category | first %} {% if category_name ==
first_post.categories[0] %} {% assign sub_categories = '' | split: '' %} {% for
post in posts_of_category %} {% assign second_category = post.categories[1] %}
{% if second_category %} {% unless sub_categories contains second_category %} {%
assign sub_categories = sub_categories | push: second_category %} {% endunless
%} {% endif %} {% endfor %} {% assign sub_categories = sub_categories | sort %}
{% assign sub_categories_size = sub_categories | size %}

<div class="card categories">
<!-- top-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 sub_categories_size > 0 %}-open{% endif %} fa-fw"
></i>

{% capture _category_url %}/categories/{{ category_name | slugify |
url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="mx-2"
>{{ category_name }}</a
>
<span class="ms-2">
<i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>

{% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="mx-2">{{ category_name }}</a>

<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}
{{
site.data.locales[lang].categories.category_measure.plural
| default: site.data.locales[lang].categories.category_measure
}}
{% else %}
{{
site.data.locales[lang].categories.category_measure.singular
| default: site.data.locales[lang].categories.category_measure
}}
{% endif -%}
,
{% endif %}

{{ 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>
<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %} {{ sub_categories_size }} {% if
sub_categories_size > 1 %} {{
site.data.locales[lang].categories.category_measure.plural | default:
site.data.locales[lang].categories.category_measure }} {% else %} {{
site.data.locales[lang].categories.category_measure.singular | default:
site.data.locales[lang].categories.category_measure }} {% endif -%} , {%
endif %} {{ 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 sub_categories_size > 0 %}
<a
href="#{{ LIST_PREFIX }}{{ group_index }}"
data-bs-toggle="collapse"
aria-expanded="true"
aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom"
>
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
<span
data-bs-toggle="collapse"
class="category-trigger hide-border-bottom disabled"
>
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div>
<!-- .card-header -->

<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div
id="{{ LIST_PREFIX }}{{ group_index }}"
class="collapse show"
aria-expanded="true"
>
<ul class="list-group">
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>

{% capture _sub_ctg_url %}/categories/{{ sub_category | slugify |
url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="mx-2"
>{{ sub_category }}</a
>

{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">
{{ posts_size }} {% if 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>

<!-- arrow -->
{% if sub_categories_size > 0 %}
<a
href="#{{ LIST_PREFIX }}{{ group_index }}"
data-bs-toggle="collapse"
aria-expanded="true"
aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom"
>
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
<span data-bs-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div>
<!-- .card-header -->

<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
<ul class="list-group">
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>

{% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="mx-2">{{ sub_category }}</a>

{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">
{{ posts_size }}

{% if 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>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
<!-- .card -->

{% assign group_index = group_index | plus: 1 %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endfor %}
</div>
<!-- .card -->

{% assign group_index = group_index | plus: 1 %} {% endif %} {% endfor %}
11 changes: 6 additions & 5 deletions _layouts/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ <h1 class="ps-lg-2">

<ul class="content ps-0">
{% for post in page.posts %}
<li class="d-flex justify-content-between px-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
{% include datetime.html date=post.date class='text-muted small text-nowrap' lang=lang %}
</li>
<li class="d-flex justify-content-between px-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
{% include datetime.html date=post.date class='text-muted small
text-nowrap' lang=lang %}
</li>
{% endfor %}
</ul>
</div>
Loading

0 comments on commit 82affcc

Please sign in to comment.