From 82affcce44cebcc1e05898370396b6b3be2e3a1f Mon Sep 17 00:00:00 2001 From: ky0422 Date: Thu, 24 Oct 2024 22:01:49 +0900 Subject: [PATCH] updated --- _config.yml | 2 +- _includes/footer.html | 57 +++++----- _layouts/categories.html | 228 +++++++++++++++++---------------------- _layouts/category.html | 11 +- _layouts/default.html | 72 +++++++------ _layouts/home.html | 164 ++++++++++++---------------- _layouts/page.html | 18 ++-- _layouts/post.html | 207 +++++++++++++++++------------------ _layouts/tag.html | 11 +- _layouts/tags.html | 26 +++-- 10 files changed, 364 insertions(+), 432 deletions(-) diff --git a/_config.yml b/_config.yml index 5beef92..9ed7a93 100644 --- a/_config.yml +++ b/_config.yml @@ -1,7 +1,7 @@ theme: jekyll-theme-chirpy remote_theme: cotes2020/jekyll-theme-chirpy -baseurl: "" +baseurl: lang: en timezone: Asia/Seoul diff --git a/_includes/footer.html b/_includes/footer.html index 1ba9b63..2ad7e1f 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -2,48 +2,39 @@ diff --git a/_layouts/categories.html b/_layouts/categories.html index 0515097..5d9be16 100644 --- a/_layouts/categories.html +++ b/_layouts/categories.html @@ -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 %} - -
- -
+ +
+ + + + {% capture _category_url %}/categories/{{ category_name | slugify | + url_encode }}/{% endcapture %} + {{ category_name }} - - - - {% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %} - {{ category_name }} - - {% assign top_posts_size = site.categories[category_name] | size %} - - {% 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 %} - + + {% assign top_posts_size = site.categories[category_name] | size %} + + {% 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 %} + + + + + {% if sub_categories_size > 0 %} + + + + {% else %} + + + + {% endif %} +
+ + + + {% if sub_categories_size > 0 %} +
+
    + {% for sub_category in sub_categories %} +
  • + + + {% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | + url_encode }}/{% endcapture %} + {{ sub_category }} + + {% assign posts_size = site.categories[sub_category] | size %} + + {{ 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 %} - - - {% if sub_categories_size > 0 %} - - - - {% else %} - - - - {% endif %} -
- - - - {% if sub_categories_size > 0 %} -
-
    - {% for sub_category in sub_categories %} -
  • - - - {% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %} - {{ sub_category }} - - {% assign posts_size = site.categories[sub_category] | size %} - - {{ 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 %} - -
  • - {% endfor %} -
-
- {% endif %} -
- - - {% assign group_index = group_index | plus: 1 %} + + {% endfor %} + +
{% endif %} -{% endfor %} + + + +{% assign group_index = group_index | plus: 1 %} {% endif %} {% endfor %} diff --git a/_layouts/category.html b/_layouts/category.html index b064f27..68273d4 100644 --- a/_layouts/category.html +++ b/_layouts/category.html @@ -14,11 +14,12 @@

diff --git a/_layouts/default.html b/_layouts/default.html index 1590ef6..b140444 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -2,18 +2,19 @@ layout: compress --- - + -{% include origin-type.html %} - -{% include lang.html %} - -{% if site.theme_mode %} - {% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %} -{% endif %} +{% include origin-type.html %} {% include lang.html %} {% if site.theme_mode %} +{% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %} {% +endif %} - + {% include head.html %} @@ -24,37 +25,38 @@ {% include topbar.html lang=lang %}
-
- {% if layout.refactor or layout.layout == 'default' %} - {% include refactor-content.html content=content lang=lang %} - {% else %} - {{ content }} - {% endif %} +
+ {% if layout.refactor or layout.layout == 'default' %} {% include + refactor-content.html content=content lang=lang %} {% else %} {{ + content }} {% endif %}
-
- {% for _include in layout.tail_includes %} - {% assign _include_path = _include | append: '.html' %} - {% include {{ _include_path }} lang=lang %} - {% endfor %} - - {% include_cached footer.html lang=lang %} + {% for _include in layout.tail_includes %} {% assign _include_path = + _include | append: '.html' %} {% include {{ _include_path }} + lang=lang %} {% endfor %} {% include_cached footer.html lang=lang %}
@@ -62,7 +64,11 @@ @@ -70,13 +76,11 @@
- {% if site.pwa.enabled %} - {% include_cached notification.html lang=lang %} + {% if site.pwa.enabled %} {% include_cached notification.html lang=lang %} {% endif %} - {% include js-selector.html lang=lang %} - - {% include_cached search-loader.html lang=lang %} + {% include js-selector.html lang=lang %} {% include_cached + search-loader.html lang=lang %} diff --git a/_layouts/home.html b/_layouts/home.html index 451e391..26fc955 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -3,120 +3,90 @@ refactor: true --- -{% include lang.html %} - -{% assign all_pinned = site.posts | where: 'pin', 'true' %} -{% assign all_normal = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %} - -{% assign posts = '' | split: '' %} +{% include lang.html %} {% assign all_pinned = site.posts | where: 'pin', 'true' +%} {% assign all_normal = site.posts | where_exp: 'item', 'item.pin != true and +item.hidden != true' %} {% assign posts = '' | split: '' %} -{% assign visible_start = paginator.page | minus: 1 | times: paginator.per_page %} -{% assign visible_end = visible_start | plus: paginator.per_page %} - -{% if all_pinned.size > visible_start %} - {% if all_pinned.size > visible_end %} - {% assign pinned_size = paginator.per_page %} - {% else %} - {% assign pinned_size = all_pinned.size | minus: visible_start %} - {% endif %} - - {% for i in (visible_start..all_pinned.size) limit: pinned_size %} - {% assign posts = posts | push: all_pinned[i] %} - {% endfor %} -{% else %} - {% assign pinned_size = 0 %} -{% endif %} +{% assign visible_start = paginator.page | minus: 1 | times: paginator.per_page +%} {% assign visible_end = visible_start | plus: paginator.per_page %} {% if +all_pinned.size > visible_start %} {% if all_pinned.size > visible_end %} {% +assign pinned_size = paginator.per_page %} {% else %} {% assign pinned_size = +all_pinned.size | minus: visible_start %} {% endif %} {% for i in +(visible_start..all_pinned.size) limit: pinned_size %} {% assign posts = posts | +push: all_pinned[i] %} {% endfor %} {% else %} {% assign pinned_size = 0 %} {% +endif %} -{% assign normal_size = paginator.posts | size | minus: pinned_size %} - -{% if normal_size > 0 %} - {% if pinned_size > 0 %} - {% assign normal_start = 0 %} - {% else %} - {% assign normal_start = visible_start | minus: all_pinned.size %} - {% endif %} - - {% assign normal_end = normal_start | plus: normal_size | minus: 1 %} - - {% for i in (normal_start..normal_end) %} - {% assign posts = posts | push: all_normal[i] %} - {% endfor %} -{% endif %} +{% assign normal_size = paginator.posts | size | minus: pinned_size %} {% if +normal_size > 0 %} {% if pinned_size > 0 %} {% assign normal_start = 0 %} {% +else %} {% assign normal_start = visible_start | minus: all_pinned.size %} {% +endif %} {% assign normal_end = normal_start | plus: normal_size | minus: 1 %} +{% for i in (normal_start..normal_end) %} {% assign posts = posts | push: +all_normal[i] %} {% endfor %} {% endif %}
{% for post in posts %} -
- - {% assign card_body_col = '12' %} - - {% if post.image %} - {% assign src = post.image.path | default: post.image %} - {% unless src contains '//' %} - {% assign src = post.media_subpath | append: '/' | append: src | replace: '//', '/' %} - {% endunless %} - - {% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %} - - {% assign lqip = null %} - - {% if post.image.lqip %} - {% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %} - {% endif %} - - + +
{% endfor %}
-{% if paginator.total_pages > 1 %} - {% include post-paginator.html %} -{% endif %} +{% if paginator.total_pages > 1 %} {% include post-paginator.html %} {% endif %} diff --git a/_layouts/page.html b/_layouts/page.html index 32d6582..2c538da 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -5,16 +5,10 @@ {% include lang.html %}
- {% if page.layout == 'page' or page.collection == 'tabs' %} - {% assign tab_key = page.title | downcase %} - {% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %} -

- {{ title }} -

-
- {{ content }} -
- {% else %} - {{ content }} - {% endif %} + {% if page.layout == 'page' or page.collection == 'tabs' %} {% assign tab_key + = page.title | downcase %} {% assign title = + site.data.locales[lang].tabs[tab_key] | default: page.title %} +

{{ title }}

+
{{ content }}
+ {% else %} {{ content }} {% endif %}
diff --git a/_layouts/post.html b/_layouts/post.html index 6a2deff..3f1fa0c 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -9,85 +9,78 @@ - comments --- -{% include lang.html %} - -{% include toc-status.html %} +{% include lang.html %} {% include toc-status.html %}

{{ page.title }}

{% if page.description %} -

{{ page.description }}

+

{{ page.description }}

{% endif %}
{% if enable_toc %} - - - + - -
-
{{- page.title -}}
- -
-
-
+ + + +
+
{{- page.title -}}
+ +
+
+
{% endif %} -
- {{ content }} -
+
{{ content }}
{% if page.categories.size > 0 %} - + {% endif %} {% if page.tags.size > 0 %} - + {% endif %}
- {% if site.data.locales[lang].copyright.license.template %} - {% capture _replacement %} + {% if site.data.locales[lang].copyright.license.template %} {% capture + _replacement %} {{ site.data.locales[lang].copyright.license.name }} - {% endcapture %} - - {{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }} - {% endif %} + {% endcapture %} {{ site.data.locales[lang].copyright.license.template | + replace: ':LICENSE_NAME', _replacement }} {% endif %}
{% include post-sharing.html lang=lang %} diff --git a/_layouts/tag.html b/_layouts/tag.html index d766d09..b2e72d5 100644 --- a/_layouts/tag.html +++ b/_layouts/tag.html @@ -13,11 +13,12 @@

    {% for post in page.posts %} -
  • - {{ post.title }} - - {% include datetime.html date=post.date class='text-muted small text-nowrap' lang=lang %} -
  • +
  • + {{ post.title }} + + {% include datetime.html date=post.date class='text-muted small + text-nowrap' lang=lang %} +
  • {% endfor %}
diff --git a/_layouts/tags.html b/_layouts/tags.html index 7800ca0..d456426 100644 --- a/_layouts/tags.html +++ b/_layouts/tags.html @@ -4,19 +4,17 @@ ---
- {% assign tags = '' | split: '' %} - {% for t in site.tags %} - {% assign tags = tags | push: t[0] %} - {% endfor %} - - {% assign sorted_tags = tags | sort_natural %} - - {% for t in sorted_tags %} - + {% assign tags = '' | split: '' %} {% for t in site.tags %} {% assign tags = + tags | push: t[0] %} {% endfor %} {% assign sorted_tags = tags | sort_natural + %} {% for t in sorted_tags %} + {% endfor %}