From 836246b4e047cb0b7958a6c8b5b7335bd71ec533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=AE=87?= <448766534@qq.com> Date: Thu, 27 Feb 2020 15:42:29 +0800 Subject: [PATCH] feat: Music --- _config.yml | 10 ++++++++++ layout/_partial/music.ejs | 16 ++++++++++++++++ layout/layout.ejs | 16 ++++++++++------ 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 layout/_partial/music.ejs diff --git a/_config.yml b/_config.yml index 02bea29..3fb869a 100644 --- a/_config.yml +++ b/_config.yml @@ -27,6 +27,8 @@ logo: /images/ayer-side.svg # 封面配置 # enable-是否启用封面;path-封面背景图;logo-封面logo + + cover: enable: true path: /images/cover1.jpg # images目录下附送多张美图,可更换 @@ -35,6 +37,14 @@ cover: # 页面顶部进度条 progressBar: ture +# 网易云音乐插件 +music: + enable: false + # 播放器尺寸类型(1:小尺寸、2:大尺寸) + type: 1 + id: 518895142 # 网易云分享的音乐ID(更换音乐请更改此配置项) + autoPlay: true # 是否开启自动播放 + # 文章配置 # 文章太长,截断按钮文字(在需要截断的行增加此标记:) excerpt_link: 阅读更多... diff --git a/layout/_partial/music.ejs b/layout/_partial/music.ejs new file mode 100644 index 0000000..c09dad5 --- /dev/null +++ b/layout/_partial/music.ejs @@ -0,0 +1,16 @@ +
+ <%# "bottom:120px; left:auto;position:fixed; width:85%" %> + <% var defaultHeight = theme.music.type == 1 ? '32' : '66'; %> + <% var defaultIframeHeight = theme.music.type == 1 ? '52' : '86'; %> + +
+ + \ No newline at end of file diff --git a/layout/layout.ejs b/layout/layout.ejs index 9f3c325..7f58043 100644 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -5,15 +5,19 @@
<%- body %> <%- partial('_partial/footer', null, {cache: !config.relative_link}) %> -
+
<%- partial('_partial/totop') %>
- - <%- partial('_partial/modal') %> - <%- partial('_partial/after-footer') %> + + <%- partial('_partial/modal') %> + <%- partial('_partial/after-footer') %> + + <% if (theme.music&&theme.music.enable){ %> + <%- partial('_partial/music') %> + <% } %>