From 97b8dfeed6ce7677f6472e28dc3b03f3c2968b12 Mon Sep 17 00:00:00 2001
From: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
Date: Sat, 18 Mar 2023 06:28:44 +0800
Subject: [PATCH 01/18] feat(ui): show preview image in home page
---
_data/locales/ar.yml | 10 +-
_data/locales/bg-BG.yml | 2 -
_data/locales/cs-CZ.yml | 10 +-
_data/locales/de-DE.yml | 2 -
_data/locales/el-GR.yml | 12 +-
_data/locales/en.yml | 10 +-
_data/locales/es-ES.yml | 4 +-
_data/locales/fi-FI.yml | 10 +-
_data/locales/fr-FR.yml | 2 -
_data/locales/hu-HU.yml | 8 +-
_data/locales/id-ID.yml | 2 -
_data/locales/it-IT.yml | 13 +-
_data/locales/ko-KR.yml | 6 +-
_data/locales/my-MM.yml | 2 -
_data/locales/pt-BR.yml | 2 -
_data/locales/ru-RU.yml | 2 -
_data/locales/tr-TR.yml | 2 -
_data/locales/uk-UA.yml | 2 -
_data/locales/vi-VN.yml | 3 -
_data/locales/zh-CN.yml | 6 +-
_includes/js-selector.html | 23 +-
_includes/refactor-content.html | 43 +--
_javascript/home.js | 8 +
_javascript/modules/components/img-extra.js | 27 --
.../modules/components/img-lazyload.js | 15 +
_javascript/modules/components/img-popup.js | 22 ++
_javascript/modules/components/pageviews.js | 8 +-
_javascript/modules/plugins.js | 3 +-
_javascript/page.js | 10 +-
_javascript/post.js | 6 +-
_layouts/home.html | 33 ++-
_layouts/page.html | 9 +-
_sass/addon/commons.scss | 11 +-
_sass/addon/module.scss | 11 +-
_sass/colors/dark-typography.scss | 13 +-
_sass/colors/light-typography.scss | 9 +-
_sass/layout/home.scss | 265 +++++++++++-------
_sass/layout/post.scss | 4 +-
rollup.config.js | 1 +
39 files changed, 347 insertions(+), 284 deletions(-)
create mode 100644 _javascript/home.js
delete mode 100644 _javascript/modules/components/img-extra.js
create mode 100644 _javascript/modules/components/img-lazyload.js
create mode 100644 _javascript/modules/components/img-popup.js
diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml
index 7f1725f..2ad043b 100644
--- a/_data/locales/ar.yml
+++ b/_data/locales/ar.yml
@@ -70,18 +70,16 @@ post:
share_link:
title: أنسخ الرابط
succeed: تم نسخ الرابط بنجاح!
- # pinned prompt of posts list on homepage
- pin_prompt: مثبت
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
diff --git a/_data/locales/bg-BG.yml b/_data/locales/bg-BG.yml
index 3e4103c..f8fe28c 100644
--- a/_data/locales/bg-BG.yml
+++ b/_data/locales/bg-BG.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Копирай линк
succeed: Линкът е копиран успешно!
- # pinned prompt of posts list on homepage
- pin_prompt: Прикрепенa
# categories page
categories:
diff --git a/_data/locales/cs-CZ.yml b/_data/locales/cs-CZ.yml
index 39b585c..6f636e3 100644
--- a/_data/locales/cs-CZ.yml
+++ b/_data/locales/cs-CZ.yml
@@ -70,18 +70,16 @@ post:
share_link:
title: Kopírovat odkaz
succeed: Zkopírováno!
- # pinned prompt of posts list on homepage
- pin_prompt: Připnuto
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
diff --git a/_data/locales/de-DE.yml b/_data/locales/de-DE.yml
index 3088a3c..7e77d95 100644
--- a/_data/locales/de-DE.yml
+++ b/_data/locales/de-DE.yml
@@ -69,8 +69,6 @@ post:
share_link:
title: Link kopieren
succeed: Link erfolgreich kopiert!
- # pinned prompt of posts list on homepage
- pin_prompt: Angepinnt
# categories page
categories:
diff --git a/_data/locales/el-GR.yml b/_data/locales/el-GR.yml
index fbc7c2b..79e45dc 100644
--- a/_data/locales/el-GR.yml
+++ b/_data/locales/el-GR.yml
@@ -70,18 +70,16 @@ post:
share_link:
title: Αντιγραφή συνδέσμου
succeed: Η διεύθυνση αντιγράφθηκε με επιτυχία!
- # pinned prompt of posts list on homepage
- pin_prompt: Pinned
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
@@ -90,4 +88,4 @@ categories:
plural: Κατηγορίες
post_measure:
singular: Δημοσίευση
- plural: Δημοσιεύσεις
\ No newline at end of file
+ plural: Δημοσιεύσεις
diff --git a/_data/locales/en.yml b/_data/locales/en.yml
index 975f5f0..fe8bf1f 100644
--- a/_data/locales/en.yml
+++ b/_data/locales/en.yml
@@ -70,18 +70,16 @@ post:
share_link:
title: Copy link
succeed: Link copied successfully!
- # pinned prompt of posts list on homepage
- pin_prompt: Pinned
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml
index ee3a20f..f26cd89 100644
--- a/_data/locales/es-ES.yml
+++ b/_data/locales/es-ES.yml
@@ -59,7 +59,7 @@ post:
pageview_measure: visitas
read_time:
unit: min
- prompt: ' de lectura'
+ prompt: " de lectura"
relate_posts: Lecturas adicionales
share: Compartir
button:
@@ -70,8 +70,6 @@ post:
share_link:
title: Copiar enlace
succeed: ¡Enlace copiado!
- # pinned prompt of posts list on homepage
- pin_prompt: Fijado
# categories page
categories:
diff --git a/_data/locales/fi-FI.yml b/_data/locales/fi-FI.yml
index 605969f..7327663 100644
--- a/_data/locales/fi-FI.yml
+++ b/_data/locales/fi-FI.yml
@@ -69,18 +69,16 @@ post:
share_link:
title: Kopioi linkki
succeed: Linkki kopioitu onnistuneesti!
- # pinned prompt of posts list on homepage
- pin_prompt: Kiinnitetty
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml
index 0d29a87..72b034d 100644
--- a/_data/locales/fr-FR.yml
+++ b/_data/locales/fr-FR.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Copier le lien
succeed: Lien copié avec succès !
- # pinned prompt of posts list on homepage
- pin_prompt: Épinglé
# categories page
categories:
diff --git a/_data/locales/hu-HU.yml b/_data/locales/hu-HU.yml
index f24b8c5..d79169c 100644
--- a/_data/locales/hu-HU.yml
+++ b/_data/locales/hu-HU.yml
@@ -38,9 +38,9 @@ copyright:
# Displayed in the footer
brief: Néhány jog fenntartva.
verbose: >-
- Az oldalon található tartalmak
- Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek,
- hacsak másképp nincs jelezve.
+ Az oldalon található tartalmak
+ Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek,
+ hacsak másképp nincs jelezve.
meta: Készítve :PLATFORM motorral :THEME témával.
@@ -72,8 +72,6 @@ post:
share_link:
title: Link másolása
succeed: Link sikeresen másolva!
- # pinned prompt of posts list on homepage
- pin_prompt: Kitűzve
# categories page
categories:
diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml
index 59ec661..c052f9a 100644
--- a/_data/locales/id-ID.yml
+++ b/_data/locales/id-ID.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Salin tautan
succeed: Tautan berhasil disalin!
- # pinned prompt of posts list on homepage
- pin_prompt: Disematkan
# categories page
categories:
diff --git a/_data/locales/it-IT.yml b/_data/locales/it-IT.yml
index 03aa19c..f29e7be 100644
--- a/_data/locales/it-IT.yml
+++ b/_data/locales/it-IT.yml
@@ -40,8 +40,7 @@ copyright:
Eccetto quando esplicitamente menzionato, i post di questo blog sono da ritenersi sotto
i termini di licenza Creative Commons Attribution 4.0 International (CC BY 4.0).
-
-meta: Servizio offerto da :PLATFORM con tema :THEME.
+meta: Servizio offerto da :PLATFORM con tema :THEME.
not_found:
statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente.
@@ -70,18 +69,16 @@ post:
share_link:
title: Copia link
succeed: Link copiato con successo!
- # pinned prompt of posts list on homepage
- pin_prompt: In alto
# Date time format.
# See: ,
df:
post:
- strftime: '%b %e, %Y'
- dayjs: 'll'
+ strftime: "%b %e, %Y"
+ dayjs: "ll"
archives:
- strftime: '%b'
- dayjs: 'MMM'
+ strftime: "%b"
+ dayjs: "MMM"
# categories page
categories:
diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml
index 73e1ded..6f9cea8 100644
--- a/_data/locales/ko-KR.yml
+++ b/_data/locales/ko-KR.yml
@@ -70,15 +70,13 @@ post:
share_link:
title: 링크 복사하기
succeed: 링크가 복사되었습니다!
- # pinned prompt of posts list on homepage
- pin_prompt: 핀
# Date time format.
# See: ,
df:
post:
- strftime: '%Y/%m/%d'
- dayjs: 'YYYY/MM/DD'
+ strftime: "%Y/%m/%d"
+ dayjs: "YYYY/MM/DD"
# categories page
categories:
diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml
index 9990c76..2669e55 100644
--- a/_data/locales/my-MM.yml
+++ b/_data/locales/my-MM.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: လင့်ခ်ကို ကူးယူရန်
succeed: လင့်ခ်ကို ကူးယူလိုက်ပြီ။
- # pinned prompt of posts list on homepage
- pin_prompt: ချိတ်ထားသည်။
# categories page
categories:
diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml
index 831e6d3..d0071c6 100644
--- a/_data/locales/pt-BR.yml
+++ b/_data/locales/pt-BR.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Copie o link
succeed: Link copiado com sucesso!
- # pinned prompt of posts list on homepage
- pin_prompt: Fixado
# categories page
categories:
diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml
index 3cd937c..91aaf06 100644
--- a/_data/locales/ru-RU.yml
+++ b/_data/locales/ru-RU.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Скопировать ссылку
succeed: Ссылка успешно скопирована!
- # pinned prompt of posts list on homepage
- pin_prompt: Закреплено
# categories page
categories:
diff --git a/_data/locales/tr-TR.yml b/_data/locales/tr-TR.yml
index f7c2567..e8ec928 100644
--- a/_data/locales/tr-TR.yml
+++ b/_data/locales/tr-TR.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Linki kopyala
succeed: Link kopyalandı.
- # pinned prompt of posts list on homepage
- pin_prompt: Sabitlendi
# categories page
categories:
diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml
index 6925e42..58b3ba5 100644
--- a/_data/locales/uk-UA.yml
+++ b/_data/locales/uk-UA.yml
@@ -70,8 +70,6 @@ post:
share_link:
title: Скопіювати посилання
succeed: Посилання успішно скопійовано!
- # pinned prompt of posts list on homepage
- pin_prompt: Закріплено
# categories page
categories:
diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml
index 592000d..6b37512 100644
--- a/_data/locales/vi-VN.yml
+++ b/_data/locales/vi-VN.yml
@@ -39,7 +39,6 @@ copyright:
verbose: >-
Trừ khi có ghi chú khác, các bài viết đăng trên trang này được cấp phép bởi tác giả theo giấy phép Creative Commons Attribution 4.0 International (CC BY 4.0).
meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME.
-
not_found:
statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại.
@@ -68,8 +67,6 @@ post:
share_link:
title: Sao chép đường dẫn
succeed: Đã sao chép đường dẫn thành công!
- # pinned prompt of posts list on homepage
- pin_prompt: Bài ghim
# categories page
categories:
diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml
index 1463e95..624706f 100644
--- a/_data/locales/zh-CN.yml
+++ b/_data/locales/zh-CN.yml
@@ -69,15 +69,13 @@ post:
share_link:
title: 分享链接
succeed: 链接已复制!
- # pinned prompt of posts list on homepage
- pin_prompt: 顶置
# Date time format.
# See: ,
df:
post:
- strftime: '%Y/%m/%d'
- dayjs: 'YYYY/MM/DD'
+ strftime: "%Y/%m/%d"
+ dayjs: "YYYY/MM/DD"
# categories page
categories:
diff --git a/_includes/js-selector.html b/_includes/js-selector.html
index 05ed99e..7d2224c 100644
--- a/_includes/js-selector.html
+++ b/_includes/js-selector.html
@@ -9,14 +9,17 @@
{% endif %}
{% endif %}
-{% if page.layout == 'post' or page.layout == 'page' %}
-
- {% assign _urls = site.data.assets[origin]['magnific-popup'].js
- | append: ','
- | append: site.data.assets[origin].lazysizes.js
- | append: ','
- | append: site.data.assets[origin].clipboard.js
- %}
+{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
+ {% assign _urls = site.data.assets[origin].lazysizes.js %}
+
+ {% unless page.layout == 'home' %}
+ {% assign _urls = _urls
+ | append: ','
+ | append: site.data.assets[origin]['magnific-popup'].js
+ | append: ','
+ | append: site.data.assets[origin].clipboard.js
+ %}
+ {% endunless %}
{% include jsdelivr-combine.html urls=_urls %}
{% endif %}
@@ -43,9 +46,9 @@
{% endif %}
{% case page.layout %}
- {% when 'categories', 'post', 'page' %}
+ {% when 'home', 'categories', 'post', 'page' %}
{% assign type = page.layout %}
- {% when 'home', 'archives', 'category', 'tag' %}
+ {% when 'archives', 'category', 'tag' %}
{% assign type = 'misc' %}
{% else %}
{% assign type = 'commons' %}
diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html
index 668d92b..2dfddbd 100644
--- a/_includes/refactor-content.html
+++ b/_includes/refactor-content.html
@@ -45,9 +45,8 @@
-{% assign IMG_TAG = '
{% assign _left = _left | append: ' data-proofer-ignore' %}
-
- {% assign _parent = _right | slice: 1, 4 %}
+ {% if page.layout == 'post' %}
+
+ {% assign _parent = _right | slice: 1, 4 %}
- {% if _parent == '' %}
-
- {% assign _size = _img_content | size | minus: 1 %}
- {% capture _class %}
- class="img-link{% unless _lqip %} shimmer{% endunless %}"
- {% endcapture %}
- {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
+ {% if _parent == '' %}
+
+ {% assign _size = _img_content | size | minus: 1 %}
+ {% capture _class %}
+ class="img-link{% unless _lqip %} shimmer{% endunless %}"
+ {% endcapture %}
+ {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
+ {% else %}
+
+ {%- capture _wrapper_start -%}
+
{%- capture _wrapper_start -%}
-