From a403ffee4223850d21cf96d401fe9cfd1a88e62e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:34:48 +0800 Subject: [PATCH 1/2] Reduce style class for page layout --- _layouts/page.html | 2 +- _sass/addon/commons.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_layouts/page.html b/_layouts/page.html index 314efa2..b94823b 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -4,7 +4,7 @@ layout: default {% include lang.html %} -
+
diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 9683c67..32a3310 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -1075,7 +1075,7 @@ $sidebar-display: "sidebar-display"; } } - .row.alone { + div.row:first-of-type:last-of-type { // alone margin-bottom: 4rem; } } From 3342abc9e6bf77c58633d246bd4d57b1362fc2e1 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 13 Dec 2021 21:55:19 +0800 Subject: [PATCH 2/2] Refactor the `page` layout --- _layouts/page.html | 30 ++++++++++++++++-------------- _layouts/post.html | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/_layouts/page.html b/_layouts/page.html index b94823b..cf998f0 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -9,25 +9,27 @@ layout: default
- {% if page.dynamic_title or page.collection == 'tabs' %} -

- {%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%} - {{- site.data.locales[lang].tabs[tab_key] | default: page.title -}} -

-
- {% if page.layout == 'page' %} - {% include refactor-content.html content=content %} - {% else %} - {{ content }} - {% endif %} -
- {% else %} - {% if page.layout == 'post' %} + + {% capture _content %} + {% if layout.refactor or page.layout == 'page' %} {% include refactor-content.html content=content %} {% else %} {{ content }} {% endif %} + {% endcapture %} + + {% if page.layout == 'page' or page.collection == 'tabs'%} + {% 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 ef2450e..6aa926d 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,5 +1,6 @@ --- layout: page +refactor: true pannel_includes: - toc tail_includes: