diff --git a/_config.yml b/_config.yml index b5c5450..c09f2ac 100755 --- a/_config.yml +++ b/_config.yml @@ -90,6 +90,14 @@ widgets: # 显示音乐播放器 music: enable: true + display: # 批量控制哪一类页面显示 + home: false # 在主页是否显示 + tag: false # 在标签页面是否显示 + category: false # 在分类页面是否显示 + archive: false # 在归档页面是否显示 + page: false # layout: page 的页面是否显示 + links: true # layout: links 的页面是否显示 + post: true # layout: post 的页面是否显示 icon: fas fa-compact-disc title: "最近在听" link: 'https://music.163.com/#/user/home?id=63035382' diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index fc6093c..eb6f6ee 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -36,12 +36,10 @@ - - - + <%- css('style.css') %> - <%- css('fontawesome-free-5.6.3-web/css/all.css') %> + <%- css('fontawesome-free-5.6.3-web/css/all.min.css') %> <% if (config.google_fonts){ %> <% } %> diff --git a/layout/_partial/meta.ejs b/layout/_partial/meta.ejs index 2f3689c..e9924bb 100644 --- a/layout/_partial/meta.ejs +++ b/layout/_partial/meta.ejs @@ -4,7 +4,7 @@ var isPostList = false; } %>
- <% if((!isPostList && post.music) || (isPostList && post.music && post.music.enable == true)){ %> + <% if((!isPostList && post.music && post.music.enable) || (isPostList && post.music && post.music.enable == true)){ %>
-
-
  <%= theme.widgets.music.title %>
- -
-
-
-
-
+<% +var needDisplay = false; +if (theme.widgets.music && theme.widgets.music.display) { + let display = theme.widgets.music.display; + if (page.layout == 'page') { + if (display.page != false) { + needDisplay = true; + } + } else if (page.layout == 'post') { + if (display.post != false && (!page.music || page.music.enable == false)) { + needDisplay = true; + } + } else if (page.layout == 'links') { + if (display.links != false) { + needDisplay = true; + } + } else { + if (is_home()) { + if (display.home != false) { + needDisplay = true; + } + } else if (is_tag()) { + if (display.tag != false) { + needDisplay = true; + } + } else if (is_category()) { + if (display.category != false) { + needDisplay = true; + } + } else if (is_archive()) { + if (display.archive != false) { + needDisplay = true; + } + } else { + needDisplay = true; + } + } +} +%> + +<% if (needDisplay == true) { %> +
+
+
  <%= theme.widgets.music.title %>
+ +
+
+
+
+
+ + + +<% } %>