From b47fe908784d559891ba7bb2d70b0741265ca2bc Mon Sep 17 00:00:00 2001
From: Mimi <1119186082@qq.com>
Date: Fri, 11 Nov 2022 19:52:39 +0800
Subject: [PATCH 1/9] Support multiple sidebar-inner
---
layout/_macro/sidebar.njk | 19 +++++++++++++++++++
layout/_partials/sidebar/site-overview.njk | 17 -----------------
source/css/_schemes/Pisces/_sidebar.styl | 8 ++++----
source/css/noscript.styl | 1 +
source/js/motion.js | 16 ++++++++++------
5 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/layout/_macro/sidebar.njk b/layout/_macro/sidebar.njk
index d892e08d6..909c2c99f 100644
--- a/layout/_macro/sidebar.njk
+++ b/layout/_macro/sidebar.njk
@@ -38,5 +38,24 @@
{%- endif %}
+
+ {# Blogroll #}
+ {%- if theme.links %}
+
+ {%- endif %}
{% endmacro %}
diff --git a/layout/_partials/sidebar/site-overview.njk b/layout/_partials/sidebar/site-overview.njk
index 48025fd91..eba8eea31 100644
--- a/layout/_partials/sidebar/site-overview.njk
+++ b/layout/_partials/sidebar/site-overview.njk
@@ -79,20 +79,3 @@
{{ next_url(ccURL, ccImage, {class: 'cc-opacity'}) }}
{%- endif %}
-
-{# Blogroll #}
-{%- if theme.links %}
-
-
- {%- if theme.links_settings.icon %}{% endif %}
- {{ __('sidebar.links') }}
-
-
- {%- for blogrollText, blogrollURL in theme.links %}
- -
- {{ next_url(blogrollURL, blogrollText, {title: blogrollURL}) }}
-
- {%- endfor %}
-
-
-{%- endif %}
diff --git a/source/css/_schemes/Pisces/_sidebar.styl b/source/css/_schemes/Pisces/_sidebar.styl
index 9197923a6..07ef7991f 100644
--- a/source/css/_schemes/Pisces/_sidebar.styl
+++ b/source/css/_schemes/Pisces/_sidebar.styl
@@ -7,10 +7,6 @@
+tablet-mobile() {
display: none;
}
-
- if (hexo-config('motion.enable') and hexo-config('motion.transition.sidebar')) {
- visibility: hidden;
- }
}
.sidebar-inner {
@@ -20,6 +16,10 @@
box-sizing: border-box;
color: var(--text-color);
margin-top: $sidebar-offset;
+
+ if (hexo-config('motion.enable') and hexo-config('motion.transition.sidebar')) {
+ visibility: hidden;
+ }
}
.site-state-item {
diff --git a/source/css/noscript.styl b/source/css/noscript.styl
index 0230c805f..8e37a2501 100644
--- a/source/css/noscript.styl
+++ b/source/css/noscript.styl
@@ -2,6 +2,7 @@ body { margin-top: 2rem; }
.use-motion .menu-item,
.use-motion .sidebar,
+.use-motion .sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
diff --git a/source/js/motion.js b/source/js/motion.js
index 3192ec56d..b01b082d3 100644
--- a/source/js/motion.js
+++ b/source/js/motion.js
@@ -104,16 +104,20 @@ NexT.motion.middleWares = {
},
sidebar: function() {
- const sidebar = document.querySelector('.sidebar');
+ const sequence = [];
+ const sidebar = document.querySelectorAll('.sidebar-inner');
const sidebarTransition = CONFIG.motion.transition.sidebar;
// Only for Pisces | Gemini.
if (sidebarTransition && (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini')) {
- return [{
- targets : sidebar,
- complete: () => sidebar.classList.add('animated', sidebarTransition)
- }];
+ sidebar.forEach(targets => {
+ sequence.push({
+ targets,
+ complete: () => targets.classList.add('animated', sidebarTransition),
+ deltaT : '-=100'
+ });
+ });
}
- return [];
+ return sequence;
},
footer: function() {
From f84826a2f35d097481e69b8175f47597baace3cf Mon Sep 17 00:00:00 2001
From: Mimi <1119186082@qq.com>
Date: Fri, 11 Nov 2022 20:14:07 +0800
Subject: [PATCH 2/9] Fix content width
---
source/css/_schemes/Muse/_sidebar.styl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source/css/_schemes/Muse/_sidebar.styl b/source/css/_schemes/Muse/_sidebar.styl
index 7e786ef4f..26eb2e192 100644
--- a/source/css/_schemes/Muse/_sidebar.styl
+++ b/source/css/_schemes/Muse/_sidebar.styl
@@ -1,6 +1,8 @@
if (hexo-config('sidebar.position') == 'right') {
.sidebar-active {
- +desktop() {
+ // Note: $sidebar-desktop + $content-desktop-large should be greater than desktop-large threshold
+ // Otherwise a horizontal scrollbar will appear
+ +desktop-large() {
padding-right: $sidebar-desktop;
}
}
@@ -14,7 +16,7 @@ if (hexo-config('sidebar.position') == 'right') {
}
} else {
.sidebar-active {
- +desktop() {
+ +desktop-large() {
padding-left: $sidebar-desktop;
}
}
From ce36136bdf0addfb85141ffccc1ec6bb3ceb9381 Mon Sep 17 00:00:00 2001
From: Mimi <1119186082@qq.com>
Date: Sat, 12 Nov 2022 01:03:14 +0800
Subject: [PATCH 3/9] Update
---
_config.yml | 2 +-
layout/_macro/post.njk | 4 ---
layout/_macro/sidebar.njk | 8 +++++
layout/_partials/post/post-related.njk | 19 +++++------
.../components/third-party/related-posts.styl | 32 ++++++++++++-------
source/js/utils.js | 2 +-
6 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/_config.yml b/_config.yml
index 0a68a1360..f01329d12 100644
--- a/_config.yml
+++ b/_config.yml
@@ -286,7 +286,7 @@ follow_me:
# Dependencies: https://github.com/sergeyzwezdin/hexo-related-posts
related_posts:
enable: false
- display_in_home: false
+ icon: fa fa-signs-post
# Post edit
# Easily browse and edit blog source code online.
diff --git a/layout/_macro/post.njk b/layout/_macro/post.njk
index 70b05c656..4729cdfc1 100644
--- a/layout/_macro/post.njk
+++ b/layout/_macro/post.njk
@@ -98,10 +98,6 @@
{### END POST BODY ###}
{#####################}
- {%- if theme.related_posts.enable and (theme.related_posts.display_in_home or not is_index) %}
- {{ partial('_partials/post/post-related.njk') }}
- {%- endif %}
-