feat(ui): show preview image in home page

This commit is contained in:
Cotes Chung 2023-03-18 06:28:44 +08:00
parent ee88cec270
commit 97b8dfeed6
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
39 changed files with 347 additions and 284 deletions

View File

@ -70,18 +70,16 @@ post:
share_link: share_link:
title: أنسخ الرابط title: أنسخ الرابط
succeed: تم نسخ الرابط بنجاح! succeed: تم نسخ الرابط بنجاح!
# pinned prompt of posts list on homepage
pin_prompt: مثبت
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Копирай линк title: Копирай линк
succeed: Линкът е копиран успешно! succeed: Линкът е копиран успешно!
# pinned prompt of posts list on homepage
pin_prompt: Прикрепенa
# categories page # categories page
categories: categories:

View File

@ -70,18 +70,16 @@ post:
share_link: share_link:
title: Kopírovat odkaz title: Kopírovat odkaz
succeed: Zkopírováno! succeed: Zkopírováno!
# pinned prompt of posts list on homepage
pin_prompt: Připnuto
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:

View File

@ -69,8 +69,6 @@ post:
share_link: share_link:
title: Link kopieren title: Link kopieren
succeed: Link erfolgreich kopiert! succeed: Link erfolgreich kopiert!
# pinned prompt of posts list on homepage
pin_prompt: Angepinnt
# categories page # categories page
categories: categories:

View File

@ -70,18 +70,16 @@ post:
share_link: share_link:
title: Αντιγραφή συνδέσμου title: Αντιγραφή συνδέσμου
succeed: Η διεύθυνση αντιγράφθηκε με επιτυχία! succeed: Η διεύθυνση αντιγράφθηκε με επιτυχία!
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:
@ -90,4 +88,4 @@ categories:
plural: Κατηγορίες plural: Κατηγορίες
post_measure: post_measure:
singular: Δημοσίευση singular: Δημοσίευση
plural: Δημοσιεύσεις plural: Δημοσιεύσεις

View File

@ -70,18 +70,16 @@ post:
share_link: share_link:
title: Copy link title: Copy link
succeed: Link copied successfully! succeed: Link copied successfully!
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:

View File

@ -59,7 +59,7 @@ post:
pageview_measure: visitas pageview_measure: visitas
read_time: read_time:
unit: min unit: min
prompt: ' de lectura' prompt: " de lectura"
relate_posts: Lecturas adicionales relate_posts: Lecturas adicionales
share: Compartir share: Compartir
button: button:
@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Copiar enlace title: Copiar enlace
succeed: ¡Enlace copiado! succeed: ¡Enlace copiado!
# pinned prompt of posts list on homepage
pin_prompt: Fijado
# categories page # categories page
categories: categories:

View File

@ -69,18 +69,16 @@ post:
share_link: share_link:
title: Kopioi linkki title: Kopioi linkki
succeed: Linkki kopioitu onnistuneesti! succeed: Linkki kopioitu onnistuneesti!
# pinned prompt of posts list on homepage
pin_prompt: Kiinnitetty
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Copier le lien title: Copier le lien
succeed: Lien copié avec succès ! succeed: Lien copié avec succès !
# pinned prompt of posts list on homepage
pin_prompt: Épinglé
# categories page # categories page
categories: categories:

View File

@ -38,9 +38,9 @@ copyright:
# Displayed in the footer # Displayed in the footer
brief: Néhány jog fenntartva. brief: Néhány jog fenntartva.
verbose: >- verbose: >-
Az oldalon található tartalmak Az oldalon található tartalmak
Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek, Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek,
hacsak másképp nincs jelezve. hacsak másképp nincs jelezve.
meta: Készítve :PLATFORM motorral :THEME témával. meta: Készítve :PLATFORM motorral :THEME témával.
@ -72,8 +72,6 @@ post:
share_link: share_link:
title: Link másolása title: Link másolása
succeed: Link sikeresen másolva! succeed: Link sikeresen másolva!
# pinned prompt of posts list on homepage
pin_prompt: Kitűzve
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Salin tautan title: Salin tautan
succeed: Tautan berhasil disalin! succeed: Tautan berhasil disalin!
# pinned prompt of posts list on homepage
pin_prompt: Disematkan
# categories page # categories page
categories: categories:

View File

@ -40,8 +40,7 @@ copyright:
Eccetto quando esplicitamente menzionato, i post di questo blog sono da ritenersi sotto 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). 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: not_found:
statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. 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: share_link:
title: Copia link title: Copia link
succeed: Link copiato con successo! succeed: Link copiato con successo!
# pinned prompt of posts list on homepage
pin_prompt: In alto
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%b %e, %Y' strftime: "%b %e, %Y"
dayjs: 'll' dayjs: "ll"
archives: archives:
strftime: '%b' strftime: "%b"
dayjs: 'MMM' dayjs: "MMM"
# categories page # categories page
categories: categories:

View File

@ -70,15 +70,13 @@ post:
share_link: share_link:
title: 링크 복사하기 title: 링크 복사하기
succeed: 링크가 복사되었습니다! succeed: 링크가 복사되었습니다!
# pinned prompt of posts list on homepage
pin_prompt:
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%Y/%m/%d' strftime: "%Y/%m/%d"
dayjs: 'YYYY/MM/DD' dayjs: "YYYY/MM/DD"
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: လင့်ခ်ကို ကူးယူရန် title: လင့်ခ်ကို ကူးယူရန်
succeed: လင့်ခ်ကို ကူးယူလိုက်ပြီ။ succeed: လင့်ခ်ကို ကူးယူလိုက်ပြီ။
# pinned prompt of posts list on homepage
pin_prompt: ချိတ်ထားသည်။
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Copie o link title: Copie o link
succeed: Link copiado com sucesso! succeed: Link copiado com sucesso!
# pinned prompt of posts list on homepage
pin_prompt: Fixado
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Скопировать ссылку title: Скопировать ссылку
succeed: Ссылка успешно скопирована! succeed: Ссылка успешно скопирована!
# pinned prompt of posts list on homepage
pin_prompt: Закреплено
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Linki kopyala title: Linki kopyala
succeed: Link kopyalandı. succeed: Link kopyalandı.
# pinned prompt of posts list on homepage
pin_prompt: Sabitlendi
# categories page # categories page
categories: categories:

View File

@ -70,8 +70,6 @@ post:
share_link: share_link:
title: Скопіювати посилання title: Скопіювати посилання
succeed: Посилання успішно скопійовано! succeed: Посилання успішно скопійовано!
# pinned prompt of posts list on homepage
pin_prompt: Закріплено
# categories page # categories page
categories: categories:

View File

@ -39,7 +39,6 @@ copyright:
verbose: >- 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). 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. meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME.
not_found: 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. 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: share_link:
title: Sao chép đường dẫn title: Sao chép đường dẫn
succeed: Đã sao chép đường dẫn thành công! 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 page
categories: categories:

View File

@ -69,15 +69,13 @@ post:
share_link: share_link:
title: 分享链接 title: 分享链接
succeed: 链接已复制! succeed: 链接已复制!
# pinned prompt of posts list on homepage
pin_prompt: 顶置
# Date time format. # Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format> # See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df: df:
post: post:
strftime: '%Y/%m/%d' strftime: "%Y/%m/%d"
dayjs: 'YYYY/MM/DD' dayjs: "YYYY/MM/DD"
# categories page # categories page
categories: categories:

View File

@ -9,14 +9,17 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if page.layout == 'post' or page.layout == 'page' %} {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
<!-- image lazy-loading & popup & clipboard --> {% assign _urls = site.data.assets[origin].lazysizes.js %}
{% assign _urls = site.data.assets[origin]['magnific-popup'].js
| append: ',' {% unless page.layout == 'home' %}
| append: site.data.assets[origin].lazysizes.js {% assign _urls = _urls
| append: ',' | append: ','
| append: site.data.assets[origin].clipboard.js | append: site.data.assets[origin]['magnific-popup'].js
%} | append: ','
| append: site.data.assets[origin].clipboard.js
%}
{% endunless %}
{% include jsdelivr-combine.html urls=_urls %} {% include jsdelivr-combine.html urls=_urls %}
{% endif %} {% endif %}
@ -43,9 +46,9 @@
{% endif %} {% endif %}
{% case page.layout %} {% case page.layout %}
{% when 'categories', 'post', 'page' %} {% when 'home', 'categories', 'post', 'page' %}
{% assign type = page.layout %} {% assign type = page.layout %}
{% when 'home', 'archives', 'category', 'tag' %} {% when 'archives', 'category', 'tag' %}
{% assign type = 'misc' %} {% assign type = 'misc' %}
{% else %} {% else %}
{% assign type = 'commons' %} {% assign type = 'commons' %}

View File

@ -45,9 +45,8 @@
<!-- images --> <!-- images -->
{% assign IMG_TAG = '<img ' %} {% if _content contains '<img' %}
{% assign IMG_TAG = '<img ' %}
{% if _content contains IMG_TAG %}
{% assign _img_content = nil %} {% assign _img_content = nil %}
{% assign _img_snippets = _content | split: IMG_TAG %} {% assign _img_snippets = _content | split: IMG_TAG %}
@ -161,28 +160,39 @@
<!-- Bypass the HTML-proofer test --> <!-- Bypass the HTML-proofer test -->
{% assign _left = _left | append: ' data-proofer-ignore' %} {% assign _left = _left | append: ' data-proofer-ignore' %}
<!-- make sure the `<img>` is wrapped by `<a>` --> {% if page.layout == 'post' %}
{% assign _parent = _right | slice: 1, 4 %} <!-- make sure the `<img>` is wrapped by `<a>` -->
{% assign _parent = _right | slice: 1, 4 %}
{% if _parent == '</a>' %} {% if _parent == '</a>' %}
<!-- add class to exist <a> tag --> <!-- add class to exist <a> tag -->
{% assign _size = _img_content | size | minus: 1 %} {% assign _size = _img_content | size | minus: 1 %}
{% capture _class %} {% capture _class %}
class="img-link{% unless _lqip %} shimmer{% endunless %}" class="img-link{% unless _lqip %} shimmer{% endunless %}"
{% endcapture %} {% endcapture %}
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %} {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
{% else %}
<!-- create the image wrapper -->
{%- capture _wrapper_start -%}
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
{%- endcapture -%}
{% assign _img_content = _img_content | append: _wrapper_start %}
{% assign _right = _right | prepend: '></a' %}
{% endif %}
{% else %} {% endif %}
{% if page.layout == 'home' %}
<!-- create the image wrapper --> <!-- create the image wrapper -->
{%- capture _wrapper_start -%} {%- capture _wrapper_start -%}
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}"> <div class="preview-img {{ _class | strip }}">
{%- endcapture -%} {%- endcapture -%}
{% assign _img_content = _img_content | append: _wrapper_start %} {% assign _img_content = _img_content | append: _wrapper_start %}
{% assign _right = _right | prepend: '></a' %} {% assign _right = _right | prepend: '></div' %}
{% endif %} {% endif %}
<!-- combine --> <!-- combine -->
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %} {% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
{% endfor %} {% endfor %}
@ -277,5 +287,4 @@
{% assign _content = _heading_content %} {% assign _content = _heading_content %}
<!-- return --> <!-- return -->
{{ _content }} {{ _content }}

8
_javascript/home.js Normal file
View File

@ -0,0 +1,8 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
import { initLocaleDatetime, imgLazy } from './modules/plugins';
basic();
initSidebar();
initTopbar();
initLocaleDatetime();
imgLazy();

View File

@ -1,27 +0,0 @@
/**
* Set up image stuff
*/
export function imgExtra() {
if ($('#core-wrapper img[data-src]') <= 0) {
return;
}
/* See: <https://github.com/dimsemenov/Magnific-Popup> */
$('.popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
showCloseBtn: false,
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out'
}
});
/* Stop shimmer when image loaded */
document.addEventListener('lazyloaded', function (e) {
const $img = $(e.target);
$img.parent().removeClass('shimmer');
});
}

View File

@ -0,0 +1,15 @@
/**
* Set up image lazy-load
*/
export function imgLazy() {
if ($('#core-wrapper img[data-src]') <= 0) {
return;
}
/* Stop shimmer when image loaded */
document.addEventListener('lazyloaded', function (e) {
const $img = $(e.target);
$img.parent().removeClass('shimmer');
});
}

View File

@ -0,0 +1,22 @@
/**
* Set up image popup
*
* See: https://github.com/dimsemenov/Magnific-Popup
*/
export function imgPopup() {
if ($('.popup') <= 0) {
return;
}
$('.popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
showCloseBtn: false,
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out'
}
});
}

View File

@ -174,13 +174,7 @@ function displayPageviews(data) {
let hasInit = getInitStatus(); let hasInit = getInitStatus();
const rows = data.rows; /* could be undefined */ const rows = data.rows; /* could be undefined */
if ($('#post-list').length > 0) { if ($('.post').length > 0) {
/* the Home page */
$('.post-preview').each(function () {
const path = $(this).find('a').attr('href');
tacklePV(rows, path, $(this).find('.pageviews'), hasInit);
});
} else if ($('.post').length > 0) {
/* the post */ /* the post */
const path = window.location.pathname; const path = window.location.pathname;
tacklePV(rows, path, $('#pv'), hasInit); tacklePV(rows, path, $('#pv'), hasInit);

View File

@ -1,6 +1,7 @@
export { categoryCollapse } from './components/category-collapse'; export { categoryCollapse } from './components/category-collapse';
export { initClipboard } from './components/clipboard'; export { initClipboard } from './components/clipboard';
export { imgExtra } from './components/img-extra'; export { imgLazy } from './components/img-lazyload';
export { imgPopup } from './components/img-popup';
export { initLocaleDatetime } from './components/locale-datetime'; export { initLocaleDatetime } from './components/locale-datetime';
export { initPageviews } from './components/pageviews'; export { initPageviews } from './components/pageviews';
export { smoothScroll } from './components/smooth-scroll'; export { smoothScroll } from './components/smooth-scroll';

View File

@ -1,9 +1,15 @@
import { basic, initSidebar, initTopbar } from './modules/layouts'; import { basic, initSidebar, initTopbar } from './modules/layouts';
import { imgExtra, initClipboard, smoothScroll } from './modules/plugins'; import {
imgLazy,
imgPopup,
initClipboard,
smoothScroll
} from './modules/plugins';
basic(); basic();
initSidebar(); initSidebar();
initTopbar(); initTopbar();
imgExtra(); imgLazy();
imgPopup();
initClipboard(); initClipboard();
smoothScroll(); smoothScroll();

View File

@ -1,6 +1,7 @@
import { basic, initSidebar, initTopbar } from './modules/layouts'; import { basic, initSidebar, initTopbar } from './modules/layouts';
import { import {
imgExtra, imgLazy,
imgPopup,
initLocaleDatetime, initLocaleDatetime,
initClipboard, initClipboard,
smoothScroll, smoothScroll,
@ -11,7 +12,8 @@ import {
basic(); basic();
initSidebar(); initSidebar();
initTopbar(); initTopbar();
imgExtra(); imgLazy();
imgPopup();
initLocaleDatetime(); initLocaleDatetime();
initClipboard(); initClipboard();
toc(); toc();

View File

@ -1,6 +1,6 @@
--- ---
layout: page layout: page
# The Home page layout refactor: true
--- ---
{% include lang.html %} {% include lang.html %}
@ -42,9 +42,16 @@ layout: page
<div id="post-list"> <div id="post-list">
{% for post in posts %} {% for post in posts %}
<div class="card post-preview"> <a href="{{ post.url | relative_url }}" class="card-wrapper">
<a href="{{ post.url | relative_url }}"> <div class="card flex-md-row-reverse">
<div class="card-body"> {% if post.image %}
{% if post.image.lqip %}
{% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
{% endif %}
<img src="{{ post.image.path | default: post.image }}" w="15" h="8" {{ lqip }}>
{% endif %}
<div class="card-body d-flex flex-column">
<h1 class="card-title"> <h1 class="card-title">
{{ post.title }} {{ post.title }}
</h1> </h1>
@ -56,16 +63,16 @@ layout: page
</p> </p>
</div> </div>
<div class="post-meta text-muted d-flex"> <div class="post-meta flex-grow-1 d-flex align-items-end">
<div class="mr-auto"> <div class="mr-auto">
<!-- posted date --> <!-- posted date -->
<i class="far fa-calendar fa-fw"></i> <i class="far fa-calendar fa-fw mr-1"></i>
{% include datetime.html date=post.date lang=lang %} {% include datetime.html date=post.date lang=lang %}
<!-- categories --> <!-- categories -->
{% if post.categories.size > 0 %} {% if post.categories.size > 0 %}
<i class="far fa-folder-open fa-fw"></i> <i class="far fa-folder-open fa-fw mr-1"></i>
<span> <span class="categories">
{% for category in post.categories %} {% for category in post.categories %}
{{ category }} {{ category }}
{%- unless forloop.last -%},{%- endunless -%} {%- unless forloop.last -%},{%- endunless -%}
@ -75,7 +82,7 @@ layout: page
</div> </div>
{% if post.pin %} {% if post.pin %}
<div class="pin"> <div class="pin ml-1">
<i class="fas fa-thumbtack fa-fw"></i> <i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.locales[lang].post.pin_prompt }}</span> <span>{{ site.data.locales[lang].post.pin_prompt }}</span>
</div> </div>
@ -83,13 +90,13 @@ layout: page
</div> </div>
<!-- .post-meta --> <!-- .post-meta -->
</div> </div>
</a> <!-- .card-body -->
</div> </div>
<!-- .post-review --> </a>
{% endfor %} {% endfor %}
</div> </div>
<!-- #post-list --> <!-- #post-list -->
{% if paginator.total_pages > 0 %} {% if paginator.total_pages > 1 %}
{% include post-paginator.html %} {% include post-paginator.html %}
{% endif %} {% endif %}

View File

@ -2,14 +2,17 @@
layout: default layout: default
--- ---
{% include assets-origin.html %}
{% include lang.html %} {% include lang.html %}
{% include assets-origin.html %}
<div class="row"> <div class="row">
<!-- core --> <!-- core -->
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4"> <div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4">
<div class="post pl-1 pr-1 pl-md-2 pr-md-2"> {% capture padding %}
{% unless page.layout == 'home' %}pl-1 pr-1{% endunless %}
{% endcapture %}
<div class="post {{ padding | strip }} pl-md-2 pr-md-2">
{% capture _content %} {% capture _content %}
{% if layout.refactor or page.layout == 'page' %} {% if layout.refactor or page.layout == 'page' %}
{% include refactor-content.html content=content lang=lang %} {% include refactor-content.html content=content lang=lang %}

View File

@ -278,7 +278,7 @@ i {
} }
[data-topbar-visible='true'] & > div { [data-topbar-visible='true'] & > div {
top: 6rem; top: 5.5rem;
} }
} }
@ -422,7 +422,6 @@ i {
.post-meta { .post-meta {
font-size: 0.85rem; font-size: 0.85rem;
word-spacing: 1px;
a { a {
&:not([class]):hover { &:not([class]):hover {
@ -549,7 +548,6 @@ i {
.img-link { .img-link {
color: transparent; color: transparent;
display: inline-flex; display: inline-flex;
overflow: hidden;
} }
.shimmer { .shimmer {
@ -1275,7 +1273,7 @@ $sidebar-display: 'sidebar-display';
/* /*
Responsive Design: Responsive Design:
{sidebar, content, panel} >= 1120px screen width {sidebar, content, panel} >= 1200px screen width
{sidebar, content} >= 850px screen width {sidebar, content} >= 850px screen width
{content} <= 849px screen width {content} <= 849px screen width
@ -1307,11 +1305,6 @@ $sidebar-display: 'sidebar-display';
100vh - #{$topbar-height} - #{$footer-height-mobile} 100vh - #{$topbar-height} - #{$footer-height-mobile}
) !important; ) !important;
h1 {
margin-top: 2.2rem;
font-size: 1.75rem;
}
.post-content { .post-content {
> blockquote[class^='prompt-'] { > blockquote[class^='prompt-'] {
@include ml-mr(-1.25rem); @include ml-mr(-1.25rem);

View File

@ -75,6 +75,7 @@
%no-cursor { %no-cursor {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
} }
@ -109,9 +110,18 @@
color: rgba(117, 117, 117, 0.9); color: rgba(117, 117, 117, 0.9);
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
} }
%text-clip {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
/* ---------- scss mixin --------- */ /* ---------- scss mixin --------- */
@mixin no-text-decoration { @mixin no-text-decoration {
@ -146,7 +156,6 @@
@mixin align-center { @mixin align-center {
position: relative; position: relative;
left: 50%; left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%); transform: translateX(-50%);
} }

View File

@ -54,8 +54,6 @@
--btn-paginator-hover-color: rgb(64, 65, 66); --btn-paginator-hover-color: rgb(64, 65, 66);
--btn-paginator-border-color: var(--btn-border-color); --btn-paginator-border-color: var(--btn-border-color);
--btn-text-color: var(--text-color); --btn-text-color: var(--text-color);
--pin-bg: rgb(34, 35, 37);
--pin-color: inherit;
/* Posts */ /* Posts */
--toc-highlight: rgb(116, 178, 243); --toc-highlight: rgb(116, 178, 243);
@ -68,9 +66,9 @@
--btn-share-color: #6c757d; --btn-share-color: #6c757d;
--btn-share-hover-color: #bfc1ca; --btn-share-hover-color: #bfc1ca;
--relate-post-date: var(--text-muted-color); --relate-post-date: var(--text-muted-color);
--card-bg: #212121; --card-bg: #1e1e1e;
--card-hovor-bg: #3a3a3a; --card-hovor-bg: #3a3a3a;
--card-border-color: rgb(53, 53, 60); --card-border-color: #2e2e2e;
--card-box-shadow: var(--main-bg); --card-box-shadow: var(--main-bg);
--kbd-wrap-color: #6a6a6a; --kbd-wrap-color: #6a6a6a;
--kbd-text-color: #d3d3d3; --kbd-text-color: #d3d3d3;
@ -101,13 +99,6 @@
--timeline-color: rgb(63, 65, 68); --timeline-color: rgb(63, 65, 68);
--timeline-year-dot-color: var(--timeline-color); --timeline-year-dot-color: var(--timeline-color);
.post img[data-src] {
&.lazyloaded {
-webkit-filter: brightness(95%);
filter: brightness(95%);
}
}
.light { .light {
display: none; display: none;
} }

View File

@ -10,7 +10,7 @@
/* Common color */ /* Common color */
--text-color: #34343c; --text-color: #34343c;
--text-muted-color: gray; --text-muted-color: #8e8e8e;
--heading-color: black; --heading-color: black;
--blockquote-border-color: #eeeeee; --blockquote-border-color: #eeeeee;
--blockquote-text-color: #9a9a9a; --blockquote-text-color: #9a9a9a;
@ -26,7 +26,7 @@
--img-bg: radial-gradient( --img-bg: radial-gradient(
circle, circle,
rgb(255, 255, 255) 0%, rgb(255, 255, 255) 0%,
rgb(249, 249, 249) 100% rgb(239, 239, 239) 100%
); );
--shimmer-bg: linear-gradient( --shimmer-bg: linear-gradient(
90deg, 90deg,
@ -57,13 +57,12 @@
--btn-paginator-hover-color: var(--sidebar-bg); --btn-paginator-hover-color: var(--sidebar-bg);
--btn-paginator-border-color: var(--sidebar-bg); --btn-paginator-border-color: var(--sidebar-bg);
--btn-text-color: #676666; --btn-text-color: #676666;
--pin-bg: #f5f5f5;
--pin-color: #999fa4;
/* Posts */ /* Posts */
--toc-highlight: #563d7c; --toc-highlight: #563d7c;
--btn-share-hover-color: var(--link-color); --btn-share-hover-color: var(--link-color);
--card-hovor-bg: #eeeeee; --card-bg: white;
--card-hovor-bg: #e2e2e2;
--card-border-color: #ececec; --card-border-color: #ececec;
--card-box-shadow: rgba(234, 234, 234, 0.76); --card-box-shadow: rgba(234, 234, 234, 0.76);
--label-color: #616161; --label-color: #616161;

View File

@ -1,6 +1,122 @@
/* /*
Style for Homepage Style for Homepage
*/ */
$card-radius: 0.5rem;
#post-list {
margin-top: 1.75rem;
a.card-wrapper {
display: block;
&:hover {
text-decoration: none;
}
&:not(:last-child) {
margin-bottom: 1.25rem;
}
}
.card {
border-radius: $card-radius;
border: 0;
background: var(--card-bg);
box-shadow: rgba(0, 0, 0, 0.05) 0 6px 14px 0,
rgba(172, 169, 169, 0.08) 0 0 0 1px;
&::before {
content: '';
position: absolute;
background: var(--card-hovor-bg);
opacity: 0;
width: 100%;
height: 100%;
border-radius: $card-radius;
z-index: 1;
}
&:hover {
border-color: var(--card-hovor-bg);
&::before {
opacity: 0.5;
}
}
%img-radius {
border-radius: $card-radius $card-radius 0 0;
}
.preview-img {
height: 10rem;
@extend %img-radius;
img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
@extend %img-radius;
}
}
.card-body {
min-height: 10.5rem;
padding: 1rem;
.card-title {
@extend %text-clip;
@include mt-mb(0.5rem);
font-size: 1.25rem;
}
%muted {
color: var(--text-muted-color) !important;
}
.card-text.post-content {
margin-top: 0;
margin-bottom: 0.5rem;
@extend %muted;
p {
@extend %text-clip;
line-height: 1.5;
margin: 0;
}
}
.post-meta {
@extend %muted;
i {
&:not(:first-child) {
margin-left: 1.5rem;
}
}
em {
@extend %normal-font-style;
color: inherit;
}
> div:first-child {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
} /* #post-list */
.pagination { .pagination {
color: var(--btn-patinator-text-color); color: var(--btn-patinator-text-color);
@ -52,87 +168,58 @@
} /* .page-item */ } /* .page-item */
} /* .pagination */ } /* .pagination */
#post-list {
margin-top: 1.75rem;
padding-right: 0.5rem;
a:hover {
text-decoration: none;
}
.post-preview {
padding: 0.25rem;
border-radius: 0.75rem;
border: 1px solid var(--card-border-color);
background: var(--card-bg);
&:hover {
background: var(--card-hovor-bg);
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
&:not(:last-child) {
margin-bottom: 1.75rem;
}
h1 {
font-size: 1.4rem;
margin: 0;
}
.post-meta {
i {
font-size: 0.73rem;
&:not(:first-child) {
margin-left: 1.2rem;
}
}
em {
@extend %normal-font-style;
}
.pin {
i {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
padding-left: 3px;
color: var(--pin-color);
}
span {
display: none;
}
}
}
.post-content {
margin-top: 0.6rem;
margin-bottom: 0.6rem;
color: var(--post-list-text-color);
> p {
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
} /* .post-preview */
} /* #post-list */
@media (hover: hover) { @media (hover: hover) {
.post-preview { #post-list .card {
transition: all 0.35s ease-in-out; transition: border-color 0.35s ease-in-out;
&::before {
transition: opacity 0.35s ease-in-out;
}
}
}
/* Tablet */
@media all and (min-width: 768px) {
#post-list {
%img-radius {
border-radius: 0 $card-radius $card-radius 0;
}
.card {
.preview-img {
width: 20rem;
height: 11.5rem; // can hold 2 lines each for title and content
}
.card-body {
min-height: 10.75rem;
width: 60%;
padding: 1.75rem 1.75rem 1.25rem 1.75rem;
.card-title {
margin-top: 0;
margin-bottom: 0.5rem;
}
.card-text {
display: inherit !important;
}
.post-meta {
i {
&:not(:first-child) {
margin-left: 1.75rem;
}
}
}
}
}
} }
} }
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.post-preview { #post-list .card {
margin-left: -0.5rem; margin-left: -0.5rem;
margin-right: -0.5rem; margin-right: -0.5rem;
} }
@ -151,27 +238,7 @@
/* Sidebar is visible */ /* Sidebar is visible */
@media all and (min-width: 831px) { @media all and (min-width: 831px) {
#post-list { #post-list {
margin-top: 3rem; margin-top: 2.5rem;
.post-preview {
padding: 0.5rem;
.post-meta {
.pin {
background: var(--pin-bg);
border-radius: 5px;
line-height: 1.4rem;
height: 1.3rem;
margin-top: 3px;
padding-left: 1px;
padding-right: 6px;
> span {
display: inline;
}
}
}
}
} }
.pagination { .pagination {
@ -194,9 +261,9 @@
} /* .pagination */ } /* .pagination */
} }
/* Panel hidden */ /* Panel is visible */
@media all and (max-width: 1200px) { @media all and (min-width: 1200px) {
#post-list { #post-list {
padding-right: 0; padding-right: 0.5rem;
} }
} }

View File

@ -27,6 +27,9 @@
} }
.preview-img { .preview-img {
overflow: hidden;
aspect-ratio: 40 / 21;
@extend %rounded; @extend %rounded;
&:not(.no-bg) { &:not(.no-bg) {
@ -36,7 +39,6 @@
} }
img { img {
aspect-ratio: 40 / 21;
-o-object-fit: cover; -o-object-fit: cover;
object-fit: cover; object-fit: cover;

View File

@ -38,6 +38,7 @@ function build(filename) {
export default [ export default [
build('commons'), build('commons'),
build('home'),
build('categories'), build('categories'),
build('page'), build('page'),
build('post'), build('post'),