💥 改cdn_use為inject,可插入代碼到head或者bottom

💥 移除對文章隱藏的支持,如需要,請使用插件,hexo-hide-posts/hexo-generator-indexed
💥 移除subtitle金山詞霸每日一句,增加搏天api的隨機語錄
 subtitle修改為網頁加載完後再加載,防止api回應過慢而阻礙網頁顯示
 適配valine 1.4.0, 刪除部分valine夜間模式代碼
 meta增加article:published_time和article:modified_time
 當沒有設置Description時,會自動讀取文章前200個文字作為meta Description
 sidebar menu 增加頭像轉圈hover
💄 調整aside和mobile sidebar 網頁資訊佈局,當缺少一個時,寬度依舊平分
🐛 調整子目錄的排版(向左對齊),修復只能點擊子目錄文字才能跳轉的bug
🔥 pug精簡 刪除recent-post.pug  改為引用mixins/post-ui.pug
This commit is contained in:
Jerry
2020-04-12 02:40:54 +08:00
parent e81a81c9d1
commit d62ec1b866
29 changed files with 223 additions and 369 deletions

View File

@@ -259,15 +259,14 @@ valine:
enable: false # if you want use valine,please set this value is true enable: false # if you want use valine,please set this value is true
appId: # leancloud application app id appId: # leancloud application app id
appKey: # leancloud application app key appKey: # leancloud application app key
notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
verify: false # valine verify code (true/false)
pageSize: 10 # comment list page size pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar avatar: monsterid # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-cn/en lang: en # i18n: zh-CN/zh-TW/en/ja
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header info guest_info: nick,mail,link #valine comment header info
recordIP: false # Record reviewer IP recordIP: false # Record reviewer IP
serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
mathjax: false
bg: /img/comment_bg.png # valine background bg: /img/comment_bg.png # valine background
count: true # top_img顯示評論數 count: true # top_img顯示評論數
@@ -493,8 +492,8 @@ subtitle:
loop: false loop: false
# source調用第三方服務 # source調用第三方服務
# source: false 關閉調用 # source: false 關閉調用
# source: 1 調用金山詞霸的每日一句(簡體) # source: 1 調用搏天api的隨機語錄簡體 https://api.btstu.cn/
# source: 2 調用一言網的一句話(簡體) #https://hitokoto.cn/ # source: 2 調用一言網的一句話(簡體) https://hitokoto.cn/
# source: 3 調用一句網(簡體) http://yijuzhan.com/ # source: 3 調用一句網(簡體) http://yijuzhan.com/
# source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/ # source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/
# subtitle 會先顯示 source , 再顯示 sub 的內容 # subtitle 會先顯示 source , 再顯示 sub 的內容
@@ -662,21 +661,23 @@ Open_Graph_meta: true
# 開啟hexo自帶的緩存加快生成速度 # 開啟hexo自帶的緩存加快生成速度
fragment_cache: true fragment_cache: true
# CDN # inject
# 網站必須 # 插入代码到头部</head>之前 和 尾部</body>之前
# 可根據需要自行添加js/css inject:
CDN_USE: head:
css: # - <link rel="stylesheet" href="xxxxx">
- /css/index.css bottom:
# - <script src="xxxx"></script>
js:
- https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js #/js/third-party/jquery.min.js
- /js/utils.js
- /js/main.js
# CDN # CDN
# 非必要不要修改 # 非必要不要修改
CDN: CDN:
# main
main_css: /css/index.css
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
main: /js/main.js
utils: /js/utils.js
# comments # comments
blueimp_md5: https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js blueimp_md5: https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js
gitalk: https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js gitalk: https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js
@@ -738,4 +739,5 @@ CDN:
fontawesome_v4: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css fontawesome_v4: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
fontawesome_v5: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css fontawesome_v5: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css
# 簡繁轉換
translate: /js/tw_cn.js translate: /js/tw_cn.js

View File

@@ -61,7 +61,7 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Add to bookmark card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article

View File

@@ -61,7 +61,7 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Add to bookmark card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article

View File

@@ -18,5 +18,4 @@ html(lang=config.language data-theme=theme.display_mode)
#error_subtitle= theme.error_404.subtitle #error_subtitle= theme.error_404.subtitle
include includes/rightside.pug include includes/rightside.pug
!=partial('includes/search/index', {}, {cache:theme.fragment_cache}) !=partial('includes/search/index', {}, {cache:theme.fragment_cache})
!=fragment_cache('my_js', function(){return my_html('js',theme.CDN_USE.js)})
include includes/additional-js.pug include includes/additional-js.pug

View File

@@ -2,9 +2,9 @@ extends includes/layout.pug
block content block content
if theme.category_ui == 'index' if theme.category_ui == 'index'
include ./includes/mixins/UI.pug include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts.category_ui #recent-posts.recent-posts.category_ui
+UI_NEW(page.posts) +postUI
include includes/pagination.pug include includes/pagination.pug
else else
include ./includes/mixins/article-sort.pug include ./includes/mixins/article-sort.pug

View File

@@ -1,3 +1,7 @@
script(src=url_for(theme.CDN.jquery))
script(src=url_for(theme.CDN.utils))
script(src=url_for(theme.CDN.main))
if theme.translate && theme.translate.enable if theme.translate && theme.translate.enable
script(src=url_for(theme.CDN.translate)) script(src=url_for(theme.CDN.translate))
@@ -63,3 +67,5 @@ if theme.mermaid.enable
if is_home() if is_home()
include ./head/subtitle.pug include ./head/subtitle.pug
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})

View File

@@ -9,8 +9,6 @@ script.
window.valine = new Valine({ window.valine = new Valine({
el:'#vcomment', el:'#vcomment',
notify: #{theme.valine.notify},
verify: #{theme.valine.verify},
appId: '#{theme.valine.appId}', appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}', appKey: '#{theme.valine.appKey}',
placeholder: '#{theme.valine.placeholder}', placeholder: '#{theme.valine.placeholder}',
@@ -19,5 +17,6 @@ script.
pageSize: '#{theme.valine.pageSize}', pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}', lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP}, recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}' serverURLs: '#{theme.valine.serverURLs}',
mathjax: #{theme.valine.mathjax}
}); });

View File

@@ -10,7 +10,7 @@
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : '' - var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title - var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
- var pageDescription = page.description || page.title || config.description - var pageDescription = page_description()
- var pageKeywords - var pageKeywords
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') - if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
@@ -22,7 +22,7 @@ meta(charset='UTF-8')
meta(http-equiv="X-UA-Compatible" content="IE=edge") meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width,initial-scale=1") meta(name="viewport" content="width=device-width,initial-scale=1")
title= tabTitle title= tabTitle
meta(name="description" content=pageDescription) meta(name="description" content!=pageDescription)
if pageKeywords if pageKeywords
meta(name="keywords" content=pageKeywords) meta(name="keywords" content=pageKeywords)
meta(name="author" content=pageAuthor) meta(name="author" content=pageAuthor)
@@ -34,9 +34,6 @@ if theme.disable_baidu_transformation
meta(http-equiv="Cache-Control" content="no-transform") meta(http-equiv="Cache-Control" content="no-transform")
meta(http-equiv="Cache-Control" content="no-siteapp") meta(http-equiv="Cache-Control" content="no-siteapp")
if page.hide == true
meta(name="robots" content="noindex")
if theme.douban if theme.douban
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict])) if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
meta(name="referrer" content="no-referrer") meta(name="referrer" content="no-referrer")
@@ -59,7 +56,8 @@ script(src=url_for(theme.CDN.js_cookies))
if theme.darkmode.enable if theme.darkmode.enable
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache}) !=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
!=fragment_cache('my_css', function(){return my_html('css',theme.CDN_USE.css)}) //- main css
link(rel='stylesheet', href=url_for(theme.CDN.main_css))
if theme.fontawesome_v5 && theme.fontawesome_v5.enable if theme.fontawesome_v5 && theme.fontawesome_v5.enable
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5)) link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
@@ -102,3 +100,5 @@ if theme.blog_title_font.font_link
include ./head/config_site.pug include ./head/config_site.pug
include ./head/noscript.pug include ./head/noscript.pug
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})

View File

@@ -4,7 +4,7 @@
if theme.twitter_meta if theme.twitter_meta
meta(name="twitter:card" content="summary") meta(name="twitter:card" content="summary")
meta(name="twitter:title" content=pageTitle) meta(name="twitter:title" content=pageTitle)
meta(name="twitter:description" content=pageDescription) meta(name="twitter:description" content!=pageDescription)
meta(name="twitter:image" content=full_url_for(page.cover || theme.avatar.img)) meta(name="twitter:image" content=full_url_for(page.cover || theme.avatar.img))
//- Open_Graph //- Open_Graph
@@ -13,5 +13,7 @@ if theme.Open_Graph_meta
meta(property="og:title" content=pageTitle) meta(property="og:title" content=pageTitle)
meta(property="og:url" content=without_html) meta(property="og:url" content=without_html)
meta(property="og:site_name" content=config.title) meta(property="og:site_name" content=config.title)
meta(property="og:description" content=pageDescription) meta(property="og:description" content!=pageDescription)
meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img)) meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img))
meta(property="article:published_time" content=date_xml(page.date))
meta(property="article:modified_time" content=date_xml(page.updated))

View File

@@ -7,103 +7,117 @@ if theme.subtitle.enable
if source == '1' if source == '1'
script. script.
var subtitleEffect = !{subtitleEffect} var subtitleType = function () {
fetch('https://api.ooopn.com/ciba/api.php',) var subtitleEffect = !{ subtitleEffect }
.then(function (res){ fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',)
return res.json(); .then(function (res) {
}) return res.json()
.then(function (data) { })
if (subtitleEffect){ .then(function (data) {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); if (subtitleEffect) {
var both = sub.unshift(data['ciba-en'],data.ciba) var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var typed = new Typed("#subtitle", { var both = sub.unshift(data.text)
strings: sub, var typed = new Typed('#subtitle', {
startDelay: 300, strings: sub,
typeSpeed: 150, startDelay: 300,
loop: !{theme.subtitle.loop}, typeSpeed: 150,
backSpeed: 50 loop: !{theme.subtitle.loop},
}); backSpeed: 50,
}else{ })
document.getElementById("subtitle").innerHTML = data['ciba-en'] } else {
} document.getElementById('subtitle').innerHTML = data.text
}) }
.catch(function (err) { })
console.error(err); .catch(function (err) {
}) console.error(err)
})
}
window.addEventListener('load', subtitleType)
else if source == '2' else if source == '2'
script. script.
var subtitleEffect = !{subtitleEffect} var subtitleType = function () {
fetch('https://v1.hitokoto.cn') var subtitleEffect = !{ subtitleEffect }
.then(function (res){ fetch('https://v1.hitokoto.cn')
return res.json(); .then(function (res) {
}) return res.json()
.then(function (data) { })
if (subtitleEffect){ .then(function (data) {
var from = '出自 ' + data.from if (subtitleEffect) {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); var from = '出自 ' + data.from
var both = sub.unshift(data.hitokoto,from) var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var typed = new Typed("#subtitle", { var both = sub.unshift(data.hitokoto, from)
strings: sub, var typed = new Typed('#subtitle', {
startDelay: 300, strings: sub,
typeSpeed: 150, startDelay: 300,
loop: !{theme.subtitle.loop}, typeSpeed: 150,
backSpeed: 50 loop: !{theme.subtitle.loop},
}); backSpeed: 50,
}else{ })
document.getElementById("subtitle").innerHTML = data.hitokoto } else {
} document.getElementById('subtitle').innerHTML = data.hitokoto
}) }
.catch(function (err) { })
console.error(err); .catch(function (err) {
}) console.error(err)
})
else if source == "3"
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
script.
var subtitleEffect = !{subtitleEffect}
var con = str[0];
if (subtitleEffect){
var from = "出自 " + str[1];
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
var both = sub.unshift(con,from)
var typed = new Typed("#subtitle", {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50
});
}else{
document.getElementById("subtitle").innerHTML = con
} }
window.addEventListener('load', subtitleType)
else if source == '3'
script.
var subtitleType = function () {
loadScript('http://yijuzhan.com/api/word.php?m=js', function () {
var subtitleEffect = !{ subtitleEffect }
var con = str[0]
if (subtitleEffect) {
var from = '出自 ' + str[1]
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = con
}
})
}
window.addEventListener('load', subtitleType)
else if source == '4' else if source == '4'
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
script. script.
var subtitleEffect = !{subtitleEffect} var subtitleType = function () {
jinrishici.load(function(result) { loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
if (subtitleEffect){ var subtitleEffect = !{ subtitleEffect }
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); jinrishici.load(function (result) {
var content = result.data.content; if (subtitleEffect) {
var both = sub.unshift(content) var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var typed = new Typed("#subtitle", { var content = result.data.content
strings: sub, var both = sub.unshift(content)
startDelay: 300, var typed = new Typed('#subtitle', {
typeSpeed: 150, strings: sub,
loop: !{theme.subtitle.loop}, startDelay: 300,
backSpeed: 50 typeSpeed: 150,
}); loop: !{theme.subtitle.loop},
}else{ backSpeed: 50,
document.getElementById("subtitle").innerHTML = result.data.content })
} } else {
}) document.getElementById('subtitle').innerHTML = result.data.content
}
})
}
)
}
window.addEventListener('load', subtitleType)
else else
- var subtitle = theme.subtitle.sub[0]
script. script.
var subtitleEffect = !{subtitleEffect} var subtitleEffect = !{subtitleEffect}
if (subtitleEffect){ if (subtitleEffect) {
var typed = new Typed("#subtitle", { var typed = new Typed("#subtitle", {
strings: '!{theme.subtitle.sub}'.split(","), strings: '!{theme.subtitle.sub}'.split(","),
startDelay: 300, startDelay: 300,
@@ -111,6 +125,6 @@ if theme.subtitle.enable
loop: !{theme.subtitle.loop}, loop: !{theme.subtitle.loop},
backSpeed: 50 backSpeed: 50
}) })
}else{ } else {
document.getElementById("subtitle").innerHTML = '!{subtitle}' document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
} }

View File

@@ -38,9 +38,5 @@ html(lang=config.language data-theme=theme.display_mode)
!=partial('includes/footer', {}, {cache:theme.fragment_cache}) !=partial('includes/footer', {}, {cache:theme.fragment_cache})
include ./rightside.pug include ./rightside.pug
!=partial('includes/search/index', {}, {cache:theme.fragment_cache}) !=partial('includes/search/index', {}, {cache:theme.fragment_cache})
!=fragment_cache('my_js', function(){return my_html('js',theme.CDN_USE.js)})
include ./additional-js.pug include ./additional-js.pug

View File

@@ -1,21 +1,26 @@
mixin UI_NEW(posts) mixin postUI(posts)
- posts.each(function(article,index){ each article , index in page.posts.data
.recent-post-item .recent-post-item
- var link = article.link || article.path - var link = article.link || article.path
- var post_cover = article.cover
- var title = article.title || _p('no_title') - var title = article.title || _p('no_title')
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius' - var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- var post_cover = article.cover
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : '' - var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
if post_cover && theme.cover.index_enable if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight) .post_cover(class=leftOrRight)
a(href=url_for(link) title=title) a(href=url_for(link) title=title)
if theme.lazyload.enable if theme.lazyload.enable
img.post_bg.lazyload(data-src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`) img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
else else
img.post_bg(src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`) img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
.recent-post-info(class=no_cover) .recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title a.article-title(href=url_for(link) title=title)= title
.article-meta-wrap .article-meta-wrap
if (is_home() && (article.top || article.sticky > 0))
span.article-meta
i.fa.fa-thumb-tack.article-meta__icon.sticky
span.sticky= _p('sticky')
span.article-meta__separator |
if (theme.post_meta.page.date_type) if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both') if (theme.post_meta.page.date_type === 'both')
time.post-meta__date time.post-meta__date
@@ -61,5 +66,3 @@ mixin UI_NEW(posts)
if theme.ad && theme.ad.index if theme.ad && theme.ad.index
if (index + 1) % 3 == 0 if (index + 1) % 3 == 0
.recent-post-item.ad_height!=theme.ad.index .recent-post-item.ad_height!=theme.ad.index
- })

View File

@@ -1,67 +0,0 @@
each article , index in page.posts.data
.recent-post-item
- var link = article.link || article.path
- var title = article.title || _p('no_title')
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- var post_cover = article.cover
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight)
a(href=url_for(link) title=title)
if theme.lazyload.enable
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
else
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
.recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title
.article-meta-wrap
if (article.top)
span.article-meta
i.fa.fa-thumb-tack.article-meta__icon.sticky
span.sticky= _p('sticky')
span.article-meta__separator |
if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both')
time.post-meta__date
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.article-meta__separator |
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
else
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
- var date_type = data_type_updated ? 'updated' : 'date'
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
i.fa(class=date_icon aria-hidden="true")
=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0)
span.article-meta
span.article-meta__separator |
each item, index in article.categories.data
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags
span.article-meta__separator |
each item, index in article.tags.data
i.fa.fa-tag.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1)
span.article-meta__link -
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(article.content)
- let expert = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
.content!= expert
else
.content!= article.description
if theme.ad && theme.ad.index
if (index + 1) % 3 == 0
.recent-post-item.ad_height!=theme.ad.index

View File

@@ -1,6 +1,7 @@
extends includes/layout.pug extends includes/layout.pug
block content block content
include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts #recent-posts.recent-posts
include includes/recent-posts.pug +postUI
include includes/pagination.pug include includes/pagination.pug

View File

@@ -2,9 +2,9 @@ extends includes/layout.pug
block content block content
if theme.tag_ui == 'index' if theme.tag_ui == 'index'
include ./includes/mixins/UI.pug include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts #recent-posts.recent-posts
+UI_NEW(page.posts) +postUI
include includes/pagination.pug include includes/pagination.pug
else else
include ./includes/mixins/article-sort.pug include ./includes/mixins/article-sort.pug

View File

@@ -1,66 +0,0 @@
/**
* global hexo
* from printempw/hexo-hide-posts
* modify by Jerry
*/
'use strict'
var public_generators = []
hexo.extend.filter.register('before_generate', function () {
this._bindLocals()
const all_posts = this.locals.get('posts')
const hidden_posts = all_posts.find({
hide: true
})
const normal_posts = all_posts.filter(post => !post.hide)
this.locals.set('all_posts', all_posts)
this.locals.set('hidden_posts', hidden_posts)
this.locals.set('posts', normal_posts)
})
hexo.extend.filter.register('after_init', function () {
const original = {}
for (const name in hexo.extend.generator.list()) {
original[name] = hexo.extend.generator.get(name)
}
hexo.extend.generator.register('post', async function (locals) {
const fg = original.post.bind(this)
const generated_public = await fg(locals)
const generated_hidden = await fg(
Object.assign({}, locals, {
posts: locals.hidden_posts
})
)
// Remove post.prev and post.next for hidden posts
generated_hidden.forEach(ele => {
ele.data.prev = ele.data.next = null
})
return generated_public.concat(generated_hidden)
})
// Then we hack into other generators if necessary
public_generators
.filter(name => Object.keys(original).includes(name))
.forEach(name => {
// Overwrite original generator
hexo.extend.generator.register(name, function (locals) {
const fg = original[name].bind(this)
return fg(
Object.assign({}, locals, {
posts: new locals.posts.constructor(
locals.posts.data.concat(locals.hidden_posts.data)
)
})
)
})
})
})

View File

@@ -1,24 +0,0 @@
/**
* Butterfly
* Generate js and css according to user setting
*/
'use strict'
hexo.extend.helper.register('my_html', function (type, data) {
var result = ''
var tag = type === 'css' ? 'css' : 'script'
for (var i = 0; i < data.length; i++) {
var src = data[i].split('||')[0].trim()
var other = data[i].split('||')[1] ? data[i].split('||')[1].trim() : ''
if (tag === 'css') {
result +=
'<link rel="stylesheet" href="' + this.url_for(src) + '" ' + other + '>'
} else {
result +=
'<script src="' + this.url_for(src) + '" ' + other + '></script>'
}
}
return result
})

31
scripts/helpers/page.js Normal file
View File

@@ -0,0 +1,31 @@
/**
* Butterfly
* @example
* page_description()
* injectHtml(data)
*/
'use strict'
const { stripHTML } = require('hexo-util')
hexo.extend.helper.register('page_description', function () {
const { config, page } = this
let description = page.description || page.excerpt || page.content || page.title || config.description
if (description) {
description = stripHTML(description).substring(0, 200)
.trim()
.replace(/\n/g, ' ')
return description
}
})
hexo.extend.helper.register('injectHtml', function (data) {
let result = ''
if (!data) return ''
for (var i = 0; i < data.length; i++) {
result += data[i]
}
return result
})

View File

@@ -1,5 +1,6 @@
/** /**
* Butterfly * Butterfly
* @example
* hideInline * hideInline
* {% hideInline content,display,bg,color %} * {% hideInline content,display,bg,color %}
* content不能包含當引號可用 &apos; * content不能包含當引號可用 &apos;

View File

@@ -16,14 +16,13 @@
.card-info .card-info
img img
display: inline-block
width: 110px width: 110px
height: 110px height: 110px
border-radius: 70px border-radius: 70px
transition: all .3s transition: all .5s
&:hover &:hover
transform: rotate(540deg) transform: rotate(360deg)
.author-info .author-info
&__name &__name
@@ -34,23 +33,24 @@
margin-top: -.3rem margin-top: -.3rem
.card-info-data .card-info-data
display: table
padding: .7rem 0 padding: .7rem 0
width: 100%
table-layout: fixed
& > .card-info-data-item & > .card-info-data-item
display: inline-block display: table-cell
width: 33.3%
a a
.headline .headline
display: block
overflow: hidden overflow: hidden
color: $font-black color: $font-black
// text-transform: uppercase
text-overflow: ellipsis text-overflow: ellipsis
white-space: nowrap white-space: nowrap
font-size: .7rem font-size: .7rem
.length_num .length_num
margin-top: -.3rem
color: $dark-black color: $dark-black
font-size: 1rem font-size: 1rem
@@ -75,7 +75,6 @@
display: block display: block
background-color: $light-blue background-color: $light-blue
color: $button-color color: $button-color
text-transform: uppercase
line-height: 1.6rem line-height: 1.6rem
span span

View File

@@ -246,14 +246,15 @@
content: '' content: ''
li li
padding: 1px 10px
list-style: none list-style: none
text-align: center
&:hover &:hover
background: $theme-color background: $theme-color
a a
display: inline-block
padding: .3rem .7rem
width: 100%
color: $font-black color: $font-black
text-shadow: none text-shadow: none

View File

@@ -27,19 +27,22 @@
text-align: center text-align: center
img img
display: inline-block
padding: 0
width: 110px width: 110px
height: 110px height: 110px
border-radius: 70px border-radius: 70px
transition: all .3s transition: all .5s
&:hover
transform: rotate(360deg)
.mobile_post_data .mobile_post_data
display: table
padding: .6rem .5rem 0 padding: .6rem .5rem 0
width: 100%
table-layout: fixed
.mobile_data_item .mobile_data_item
display: inline-block display: table-cell
width: 33.3%
.mobile_data_link .mobile_data_link
& > a > div & > a > div
@@ -54,15 +57,13 @@
.headline .headline
display: block display: block
color: $font-black color: $font-black
// text-transform: uppercase
font-size: .7rem font-size: .7rem
hr hr
margin: 1rem auto margin: 1rem auto
.menus_items .menus_items
margin-bottom: 5rem padding: 0 .5rem 2rem
padding: 0 .5rem
.site-page .site-page
position: relative position: relative

View File

@@ -163,9 +163,6 @@ a.fancybox
width: 100% width: 100%
text-align: center text-align: center
p
margin: 0 0 .8rem
img img
max-width: 100% max-width: 100%
transition: all .2s transition: all .2s
@@ -328,6 +325,9 @@ img
img img
margin: 0 auto .8rem margin: 0 auto .8rem
p
margin: 0 0 .8rem
@media screen and (max-width: 1024px) @media screen and (max-width: 1024px)
.layout_post .layout_post
width: auto width: auto

View File

@@ -1,28 +1,25 @@
if hexo-config('valine.enable') if hexo-config('valine.enable')
// valine
#vcomment #vcomment
button button
padding: .3rem 1rem padding: .3rem .8rem
border-color: $button-color border-color: $button-color
background-color: $light-blue background-color: $light-blue
color: $button-color color: $button-color
font-size: .7rem font-size: .7rem
transition: all .3s
&:hover &:hover
background-color: $theme-button-hover-color background-color: $theme-button-hover-color
textarea if hexo-config('valine.bg')
if hexo-config('valine.bg') textarea
background: url(hexo-config('valine.bg')) 100% 100% no-repeat background: url(hexo-config('valine.bg')) 100% 100% no-repeat
.info
display: none
.vimg .vimg
border: 0 transition: all .3s
&:hover &:hover
transform: rotate(540deg) transform: rotate(360deg)
.vat .vat
padding: 0 .8rem padding: 0 .8rem
@@ -30,6 +27,7 @@ if hexo-config('valine.enable')
border-radius: 5px border-radius: 5px
color: $light-blue color: $light-blue
font-size: .7125rem font-size: .7125rem
transition: all .3s
&:hover &:hover
background-color: $light-blue background-color: $light-blue

View File

@@ -270,61 +270,19 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
fill: alpha(#FFFFFF, .6) !important fill: alpha(#FFFFFF, .6) !important
if hexo-config('valine') && hexo-config('valine.enable') if hexo-config('valine') && hexo-config('valine.enable')
//
#vcomment #vcomment
p,
a,
textarea,
.vemoji-btn,
.vpreview-btn,
input,
path,
.vcount,
.vnum,
.vtime,
.vsys,
.vsys,
.vnick
color: alpha(#FFFFFF, .6) !important
.vsys .vsys
background: rgb(97, 106, 107) !important background: #2c2c2c !important
.vbtn, .vbtn,
.vat .vat
border: 1px solid alpha(#FFFFFF, .6) border: 1px solid alpha(#FFFFFF, .6)
background: lighten(#121212, 5) !important background: #121212 !important
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .6) !important
&:hover &:hover
background: lighten(#121212, 20) !important background: lighten(#121212, 20) !important
.vwrap
border: 1px solid alpha(#FFFFFF, .6)
input
border-bottom: 1px dashed #616a6b
.vh
border-bottom: 1px dashed #616a6b
pre
border: 1px solid alpha(#FFFFFF, .6)
background-color: #121212
code
background: transparent
code
background-color: #2c2c2c
color: alpha(#FFFFFF, .6)
.vcontent.expand:before
background: linear-gradient(180deg, hsla(0, 0, 0, 0), hsl(218, 8%, 19%))
.vcontent.expand:after
background: hsla(204, 5%, 22%, 1)
if hexo-config('local_search') && hexo-config('local_search.enable') if hexo-config('local_search') && hexo-config('local_search.enable')
#local-search #local-search
background: #121212 background: #121212