diff --git a/_config.yml b/_config.yml index 4358c6d..4b507b2 100755 --- a/_config.yml +++ b/_config.yml @@ -4,10 +4,10 @@ info: docs: https://xaoxuu.com/wiki/material-x/ cdn: # 把对应的那一行注释掉就使用本地的文件 css: - style: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.18/css/style.css + style: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.19/css/style.css js: - app: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.18/js/app.js - search: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.18/js/search.js + app: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.19/js/app.js + search: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.4.19/js/search.js volantis: https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1/js/volantis.min.js @@ -44,6 +44,16 @@ avatar_placeholder: https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/avatar/avat date_format: 'YYYY-MM-DD' # 文章发布日期的格式 updated_date_format: 'll' # 文章更新日期的格式 +# 幻灯片 +# backstretch: +# position: cover # cover: 封面背景 full: 整个网页背景 +# duration: 6000 # 持续时间(毫秒) +# fade: 1500 # 渐变(毫秒) +# images: +# - https://img.vim-cn.com/f6/78aed21213230b9220f310f9ea6c822b011846.jpg +# - https://img.vim-cn.com/d5/b004c81a13aea401375d03b1258ecadbfcbaa7.jpg +# - https://img.vim-cn.com/4c/8e7294998989454b2dcd2624373d5a699c4414.jpg + ############################### 自定义 ############################### # page的封面 @@ -217,6 +227,19 @@ share: # footer: '页脚文字,支持[markdown](/)' +############################### 评论系统 ############################### +# disqus_shortname: 要使用哪个请复制到根目录配置文件! +# livere_uid: 要使用哪个请复制到根目录配置文件! +# gitalk: 要使用哪个请复制到根目录配置文件! +# clientID: 你的clientID +# clientSecret: 你的clientSecret +# repo: 你的repo名 +# owner: 你的GitHub名 +# admin: [] 至少填写你的GitHub名 +# leancloud: 要使用哪个请复制到根目录配置文件! +# app_id: 你的appId +# app_key: 你的appKey + ############################### 杂项,请勿删除 ############################### #valine配置 diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index e232ab8..ae9ed3d 100755 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -81,6 +81,12 @@ <% } %> <% }) %> +<% + if (sections.indexOf('comments') < 0) { + page.comments = false; + } +%> + <% if (page.mathjax){ %> <%- partial('mathjax') %> diff --git a/layout/_partial/cover.ejs b/layout/_partial/cover.ejs index b457da6..c6c84f4 100644 --- a/layout/_partial/cover.ejs +++ b/layout/_partial/cover.ejs @@ -1,31 +1,10 @@ -<% -var showCover = false; -if (theme.cover) { - // 如果页面的Front-matter声明了cover,就取页面的值 - if (page.cover != undefined) { - showCover = page.cover; - } else { - // 否则,如果是首页,只有首页的第一页显示 - if (is_home()) { - if (page.prev) { - showCover = false; - } else { - showCover = true; - } - } else { - showCover = true; - } - } -} -%> - <% if (showCover == true) { %>
-
+ <% if (theme.cover.scheme == 'search') { %> <%- partial('../_cover/search') %> <% } %> -
+ <%- partial('header', null, {cache: false, path: path}) %>
<% } else { %> diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index 1565820..b728751 100755 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -54,13 +54,44 @@ <% } %> +<% if (theme.backstretch && (theme.backstretch.images || page.images)) { %> + <% var imgs = theme.backstretch.images || page.images; %> + <% var posi = null; + if (theme.backstretch.position == 'cover') { + posi = '.cover'; + } + %> + <% if (imgs != undefined && theme.backstretch.position != undefined){ %> + + + <% } %> +<% } %> + <% var enableDisqus = false; var enableLivere = false; var enableGitalk = false; var enableValine = false; - if (page && page.comments != false) { + if (page && page.comments == true) { if (config.disqus_shortname) { enableDisqus = true; } diff --git a/layout/_third-party/comments.ejs b/layout/_third-party/comments.ejs index 6b6661c..2543fd2 100644 --- a/layout/_third-party/comments.ejs +++ b/layout/_third-party/comments.ejs @@ -52,4 +52,6 @@ <% } %> +<% } else { %> + <% page.comments = false; %> <% } %> diff --git a/layout/category.ejs b/layout/category.ejs index ca39f69..fc1ea2a 100755 --- a/layout/category.ejs +++ b/layout/category.ejs @@ -1,3 +1,4 @@ +<% page.comments = false; %>
'> <% if (site.posts && site.posts.length > 0) { %> <% if (page.layout == 'category') { %> diff --git a/layout/layout.ejs b/layout/layout.ejs index e15f045..29acf0c 100755 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -2,8 +2,28 @@ <%- partial('_partial/head') %> - <%- partial('_partial/cover') %> -
+ <% + var showCover = false; + if (theme.cover) { + // 如果页面的Front-matter声明了cover,就取页面的值 + if (page.cover != undefined && page.cover != undefined) { + showCover = page.cover; + } else { + // 否则,如果是首页,只有首页的第一页显示 + if (is_home()) { + if (page.prev) { + showCover = false; + } else { + showCover = true; + } + } else { + showCover = true; + } + } + } + %> + <%- partial('_partial/cover', {showCover: showCover}) %> +
<%- body %> diff --git a/layout/list.ejs b/layout/list.ejs index 3dd243e..c41d87e 100755 --- a/layout/list.ejs +++ b/layout/list.ejs @@ -1,3 +1,4 @@ +<% page.comments = false; %>
'> <% if (site.posts && site.posts.length > 0) { %>
diff --git a/layout/tag.ejs b/layout/tag.ejs index 30a506d..7c62c10 100755 --- a/layout/tag.ejs +++ b/layout/tag.ejs @@ -1,3 +1,4 @@ +<% page.comments = false; %>
<% if (site.posts && site.posts.length > 0) { %> <% if (page.layout == 'tag') { %> diff --git a/source/js/app.js b/source/js/app.js index 8cce787..764ebdf 100755 --- a/source/js/app.js +++ b/source/js/app.js @@ -36,7 +36,7 @@ var customSearch; const $coverAnchor = $('.cover-wrapper'); var showHeaderPoint = 0; if ($coverAnchor[0]) { - showHeaderPoint = $coverAnchor[0].clientHeight - 64; + showHeaderPoint = $coverAnchor[0].clientHeight - 164; } var pos = document.body.scrollTop; $(document, window).scroll(() => { diff --git a/source/less/_base.less b/source/less/_base.less index 8b8c719..2266292 100755 --- a/source/less/_base.less +++ b/source/less/_base.less @@ -46,17 +46,19 @@ fancybox{ display: flex; justify-content: center; } - +.backstretch { + opacity: .75; +} .cover-wrapper{ + padding-bottom: 2px; .cover{ top: 0; left: 0; max-width: 100%; - height: ~"calc(100vh - @{gap} - @{height_navbar})"; + height: ~"calc(100vh)"; display: flex; flex-wrap: nowrap; flex-direction: column; - margin-bottom: 2*@gap; align-items: center; align-self: center; align-content: center; @@ -147,10 +149,15 @@ fancybox{ &.half{ height: ~"calc(60vh - @{gap} - @{height_navbar})"; .title, .logo{ - margin-top: ~"calc(20vh - 2*@{gap})"; + margin-top: ~"calc(20vh - 4*@{gap})"; + } + @media(max-width: @on_phone){ + .title, .logo{ + margin-top: ~"calc(32vh - 6*@{gap})"; + } } .m_search{ - margin-top: 2vh; + margin-top: 1vh; } } &, a{ @@ -483,7 +490,10 @@ ul.h-list { .l_body { position: relative; margin: @gap; - margin-top: @height_navbar + @gap; + margin-top: @gap; + &.nocover{ + margin-top: @gap + @height_navbar; + } @media(max-width: @on_phone) { margin: @height_navbar + @gap 0 @gap; border-radius: 0;