mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-08 12:07:06 +08:00
💥 改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:
34
_config.yml
34
_config.yml
@@ -259,15 +259,14 @@ valine:
|
||||
enable: false # if you want use valine,please set this value is true
|
||||
appId: # leancloud application app id
|
||||
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
|
||||
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 )
|
||||
guest_info: nick,mail,link #valine comment header info
|
||||
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)
|
||||
mathjax: false
|
||||
bg: /img/comment_bg.png # valine background
|
||||
count: true # top_img顯示評論數
|
||||
|
||||
@@ -493,8 +492,8 @@ subtitle:
|
||||
loop: false
|
||||
# source調用第三方服務
|
||||
# source: false 關閉調用
|
||||
# source: 1 調用金山詞霸的每日一句(簡體)
|
||||
# source: 2 調用一言網的一句話(簡體) #https://hitokoto.cn/
|
||||
# source: 1 調用搏天api的隨機語錄(簡體) https://api.btstu.cn/
|
||||
# source: 2 調用一言網的一句話(簡體) https://hitokoto.cn/
|
||||
# source: 3 調用一句網(簡體) http://yijuzhan.com/
|
||||
# source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/
|
||||
# subtitle 會先顯示 source , 再顯示 sub 的內容
|
||||
@@ -662,21 +661,23 @@ Open_Graph_meta: true
|
||||
# 開啟hexo自帶的緩存,加快生成速度
|
||||
fragment_cache: true
|
||||
|
||||
# CDN
|
||||
# 網站必須
|
||||
# 可根據需要自行添加js/css
|
||||
CDN_USE:
|
||||
css:
|
||||
- /css/index.css
|
||||
|
||||
js:
|
||||
- https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js #/js/third-party/jquery.min.js
|
||||
- /js/utils.js
|
||||
- /js/main.js
|
||||
# inject
|
||||
# 插入代码到头部</head>之前 和 尾部</body>之前
|
||||
inject:
|
||||
head:
|
||||
# - <link rel="stylesheet" href="xxxxx">
|
||||
bottom:
|
||||
# - <script src="xxxx"></script>
|
||||
|
||||
# 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
|
||||
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
|
||||
@@ -738,4 +739,5 @@ CDN:
|
||||
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
|
||||
|
||||
# 簡繁轉換
|
||||
translate: /js/tw_cn.js
|
||||
|
||||
@@ -61,7 +61,7 @@ aside:
|
||||
card_tags: Tags
|
||||
card_archives: Archives
|
||||
card_recent_post: Recent Post
|
||||
card_bookmark: Add to bookmark
|
||||
card_bookmark: Bookmark
|
||||
card_webinfo:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
|
||||
@@ -61,7 +61,7 @@ aside:
|
||||
card_tags: Tags
|
||||
card_archives: Archives
|
||||
card_recent_post: Recent Post
|
||||
card_bookmark: Add to bookmark
|
||||
card_bookmark: Bookmark
|
||||
card_webinfo:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
|
||||
@@ -18,5 +18,4 @@ html(lang=config.language data-theme=theme.display_mode)
|
||||
#error_subtitle= theme.error_404.subtitle
|
||||
include includes/rightside.pug
|
||||
!=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
|
||||
|
||||
@@ -2,9 +2,9 @@ extends includes/layout.pug
|
||||
|
||||
block content
|
||||
if theme.category_ui == 'index'
|
||||
include ./includes/mixins/UI.pug
|
||||
include ./includes/mixins/post-ui.pug
|
||||
#recent-posts.recent-posts.category_ui
|
||||
+UI_NEW(page.posts)
|
||||
+postUI
|
||||
include includes/pagination.pug
|
||||
else
|
||||
include ./includes/mixins/article-sort.pug
|
||||
|
||||
@@ -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
|
||||
script(src=url_for(theme.CDN.translate))
|
||||
|
||||
@@ -62,4 +66,6 @@ if theme.mermaid.enable
|
||||
include ./math/mermaid.pug
|
||||
|
||||
if is_home()
|
||||
include ./head/subtitle.pug
|
||||
include ./head/subtitle.pug
|
||||
|
||||
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
|
||||
|
||||
@@ -9,8 +9,6 @@ script.
|
||||
|
||||
window.valine = new Valine({
|
||||
el:'#vcomment',
|
||||
notify: #{theme.valine.notify},
|
||||
verify: #{theme.valine.verify},
|
||||
appId: '#{theme.valine.appId}',
|
||||
appKey: '#{theme.valine.appKey}',
|
||||
placeholder: '#{theme.valine.placeholder}',
|
||||
@@ -19,5 +17,6 @@ script.
|
||||
pageSize: '#{theme.valine.pageSize}',
|
||||
lang: '#{theme.valine.lang}',
|
||||
recordIP: #{theme.valine.recordIP},
|
||||
serverURLs: '#{theme.valine.serverURLs}'
|
||||
serverURLs: '#{theme.valine.serverURLs}',
|
||||
mathjax: #{theme.valine.mathjax}
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
||||
- 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
|
||||
- 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
|
||||
@@ -22,7 +22,7 @@ meta(charset='UTF-8')
|
||||
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
||||
meta(name="viewport" content="width=device-width,initial-scale=1")
|
||||
title= tabTitle
|
||||
meta(name="description" content=pageDescription)
|
||||
meta(name="description" content!=pageDescription)
|
||||
if pageKeywords
|
||||
meta(name="keywords" content=pageKeywords)
|
||||
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-siteapp")
|
||||
|
||||
if page.hide == true
|
||||
meta(name="robots" content="noindex")
|
||||
|
||||
if theme.douban
|
||||
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
|
||||
meta(name="referrer" content="no-referrer")
|
||||
@@ -59,7 +56,8 @@ script(src=url_for(theme.CDN.js_cookies))
|
||||
if theme.darkmode.enable
|
||||
!=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
|
||||
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/noscript.pug
|
||||
|
||||
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
||||
@@ -4,7 +4,7 @@
|
||||
if theme.twitter_meta
|
||||
meta(name="twitter:card" content="summary")
|
||||
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))
|
||||
|
||||
//- Open_Graph
|
||||
@@ -13,5 +13,7 @@ if theme.Open_Graph_meta
|
||||
meta(property="og:title" content=pageTitle)
|
||||
meta(property="og:url" content=without_html)
|
||||
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="article:published_time" content=date_xml(page.date))
|
||||
meta(property="article:modified_time" content=date_xml(page.updated))
|
||||
|
||||
@@ -7,103 +7,117 @@ if theme.subtitle.enable
|
||||
|
||||
if source == '1'
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
fetch('https://api.ooopn.com/ciba/api.php',)
|
||||
.then(function (res){
|
||||
return res.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect){
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var both = sub.unshift(data['ciba-en'],data.ciba)
|
||||
var typed = new Typed("#subtitle", {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = data['ciba-en']
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
})
|
||||
var subtitleType = function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',)
|
||||
.then(function (res) {
|
||||
return res.json()
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect) {
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var both = sub.unshift(data.text)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.text
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else if source == '2'
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
fetch('https://v1.hitokoto.cn')
|
||||
.then(function (res){
|
||||
return res.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect){
|
||||
var from = '出自 ' + data.from
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var both = sub.unshift(data.hitokoto,from)
|
||||
var typed = new Typed("#subtitle", {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = data.hitokoto
|
||||
}
|
||||
})
|
||||
.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
|
||||
var subtitleType = function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
fetch('https://v1.hitokoto.cn')
|
||||
.then(function (res) {
|
||||
return res.json()
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect) {
|
||||
var from = '出自 ' + data.from
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var both = sub.unshift(data.hitokoto, from)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.hitokoto
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
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'
|
||||
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
jinrishici.load(function(result) {
|
||||
if (subtitleEffect){
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var content = result.data.content;
|
||||
var both = sub.unshift(content)
|
||||
var typed = new Typed("#subtitle", {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = result.data.content
|
||||
}
|
||||
})
|
||||
var subtitleType = function () {
|
||||
loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
jinrishici.load(function (result) {
|
||||
if (subtitleEffect) {
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var content = result.data.content
|
||||
var both = sub.unshift(content)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = result.data.content
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else
|
||||
- var subtitle = theme.subtitle.sub[0]
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
if (subtitleEffect){
|
||||
if (subtitleEffect) {
|
||||
var typed = new Typed("#subtitle", {
|
||||
strings: '!{theme.subtitle.sub}'.split(","),
|
||||
startDelay: 300,
|
||||
@@ -111,6 +125,6 @@ if theme.subtitle.enable
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
})
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = '!{subtitle}'
|
||||
}
|
||||
} else {
|
||||
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
|
||||
}
|
||||
|
||||
@@ -38,9 +38,5 @@ html(lang=config.language data-theme=theme.display_mode)
|
||||
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
|
||||
|
||||
include ./rightside.pug
|
||||
|
||||
!=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
|
||||
@@ -1,21 +1,26 @@
|
||||
mixin UI_NEW(posts)
|
||||
- posts.each(function(article,index){
|
||||
mixin postUI(posts)
|
||||
each article , index in page.posts.data
|
||||
.recent-post-item
|
||||
- var link = article.link || article.path
|
||||
- var post_cover = article.cover
|
||||
- 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)
|
||||
a(href=url_for(link) title=title)
|
||||
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
|
||||
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)
|
||||
a.article-title(href=url_for(link) title=title)= title
|
||||
.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 === 'both')
|
||||
time.post-meta__date
|
||||
@@ -57,9 +62,7 @@ mixin UI_NEW(posts)
|
||||
.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
|
||||
|
||||
- })
|
||||
@@ -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
|
||||
@@ -1,6 +1,7 @@
|
||||
extends includes/layout.pug
|
||||
|
||||
block content
|
||||
include ./includes/mixins/post-ui.pug
|
||||
#recent-posts.recent-posts
|
||||
include includes/recent-posts.pug
|
||||
+postUI
|
||||
include includes/pagination.pug
|
||||
@@ -2,9 +2,9 @@ extends includes/layout.pug
|
||||
|
||||
block content
|
||||
if theme.tag_ui == 'index'
|
||||
include ./includes/mixins/UI.pug
|
||||
include ./includes/mixins/post-ui.pug
|
||||
#recent-posts.recent-posts
|
||||
+UI_NEW(page.posts)
|
||||
+postUI
|
||||
include includes/pagination.pug
|
||||
else
|
||||
include ./includes/mixins/article-sort.pug
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -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
31
scripts/helpers/page.js
Normal 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
|
||||
})
|
||||
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Butterfly
|
||||
* @example
|
||||
* hideInline
|
||||
* {% hideInline content,display,bg,color %}
|
||||
* content不能包含當引號,可用 '
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
|
||||
.card-info
|
||||
img
|
||||
display: inline-block
|
||||
width: 110px
|
||||
height: 110px
|
||||
border-radius: 70px
|
||||
transition: all .3s
|
||||
transition: all .5s
|
||||
|
||||
&:hover
|
||||
transform: rotate(540deg)
|
||||
transform: rotate(360deg)
|
||||
|
||||
.author-info
|
||||
&__name
|
||||
@@ -34,23 +33,24 @@
|
||||
margin-top: -.3rem
|
||||
|
||||
.card-info-data
|
||||
display: table
|
||||
padding: .7rem 0
|
||||
width: 100%
|
||||
table-layout: fixed
|
||||
|
||||
& > .card-info-data-item
|
||||
display: inline-block
|
||||
width: 33.3%
|
||||
display: table-cell
|
||||
|
||||
a
|
||||
.headline
|
||||
display: block
|
||||
overflow: hidden
|
||||
color: $font-black
|
||||
// text-transform: uppercase
|
||||
text-overflow: ellipsis
|
||||
white-space: nowrap
|
||||
font-size: .7rem
|
||||
|
||||
.length_num
|
||||
margin-top: -.3rem
|
||||
color: $dark-black
|
||||
font-size: 1rem
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
display: block
|
||||
background-color: $light-blue
|
||||
color: $button-color
|
||||
text-transform: uppercase
|
||||
line-height: 1.6rem
|
||||
|
||||
span
|
||||
|
||||
@@ -246,14 +246,15 @@
|
||||
content: ''
|
||||
|
||||
li
|
||||
padding: 1px 10px
|
||||
list-style: none
|
||||
text-align: center
|
||||
|
||||
&:hover
|
||||
background: $theme-color
|
||||
|
||||
a
|
||||
display: inline-block
|
||||
padding: .3rem .7rem
|
||||
width: 100%
|
||||
color: $font-black
|
||||
text-shadow: none
|
||||
|
||||
|
||||
@@ -27,19 +27,22 @@
|
||||
text-align: center
|
||||
|
||||
img
|
||||
display: inline-block
|
||||
padding: 0
|
||||
width: 110px
|
||||
height: 110px
|
||||
border-radius: 70px
|
||||
transition: all .3s
|
||||
transition: all .5s
|
||||
|
||||
&:hover
|
||||
transform: rotate(360deg)
|
||||
|
||||
.mobile_post_data
|
||||
display: table
|
||||
padding: .6rem .5rem 0
|
||||
width: 100%
|
||||
table-layout: fixed
|
||||
|
||||
.mobile_data_item
|
||||
display: inline-block
|
||||
width: 33.3%
|
||||
display: table-cell
|
||||
|
||||
.mobile_data_link
|
||||
& > a > div
|
||||
@@ -54,15 +57,13 @@
|
||||
.headline
|
||||
display: block
|
||||
color: $font-black
|
||||
// text-transform: uppercase
|
||||
font-size: .7rem
|
||||
|
||||
hr
|
||||
margin: 1rem auto
|
||||
|
||||
.menus_items
|
||||
margin-bottom: 5rem
|
||||
padding: 0 .5rem
|
||||
padding: 0 .5rem 2rem
|
||||
|
||||
.site-page
|
||||
position: relative
|
||||
|
||||
@@ -163,9 +163,6 @@ a.fancybox
|
||||
width: 100%
|
||||
text-align: center
|
||||
|
||||
p
|
||||
margin: 0 0 .8rem
|
||||
|
||||
img
|
||||
max-width: 100%
|
||||
transition: all .2s
|
||||
@@ -328,6 +325,9 @@ img
|
||||
img
|
||||
margin: 0 auto .8rem
|
||||
|
||||
p
|
||||
margin: 0 0 .8rem
|
||||
|
||||
@media screen and (max-width: 1024px)
|
||||
.layout_post
|
||||
width: auto
|
||||
|
||||
@@ -1,28 +1,25 @@
|
||||
if hexo-config('valine.enable')
|
||||
// valine
|
||||
#vcomment
|
||||
button
|
||||
padding: .3rem 1rem
|
||||
padding: .3rem .8rem
|
||||
border-color: $button-color
|
||||
background-color: $light-blue
|
||||
color: $button-color
|
||||
font-size: .7rem
|
||||
transition: all .3s
|
||||
|
||||
&:hover
|
||||
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
|
||||
|
||||
.info
|
||||
display: none
|
||||
|
||||
.vimg
|
||||
border: 0
|
||||
transition: all .3s
|
||||
|
||||
&:hover
|
||||
transform: rotate(540deg)
|
||||
transform: rotate(360deg)
|
||||
|
||||
.vat
|
||||
padding: 0 .8rem
|
||||
@@ -30,6 +27,7 @@ if hexo-config('valine.enable')
|
||||
border-radius: 5px
|
||||
color: $light-blue
|
||||
font-size: .7125rem
|
||||
transition: all .3s
|
||||
|
||||
&:hover
|
||||
background-color: $light-blue
|
||||
|
||||
@@ -270,61 +270,19 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
|
||||
fill: alpha(#FFFFFF, .6) !important
|
||||
|
||||
if hexo-config('valine') && hexo-config('valine.enable')
|
||||
// 評論
|
||||
#vcomment
|
||||
p,
|
||||
a,
|
||||
textarea,
|
||||
.vemoji-btn,
|
||||
.vpreview-btn,
|
||||
input,
|
||||
path,
|
||||
.vcount,
|
||||
.vnum,
|
||||
.vtime,
|
||||
.vsys,
|
||||
.vsys,
|
||||
.vnick
|
||||
color: alpha(#FFFFFF, .6) !important
|
||||
|
||||
.vsys
|
||||
background: rgb(97, 106, 107) !important
|
||||
background: #2c2c2c !important
|
||||
|
||||
.vbtn,
|
||||
.vat
|
||||
border: 1px solid alpha(#FFFFFF, .6)
|
||||
background: lighten(#121212, 5) !important
|
||||
background: #121212 !important
|
||||
color: alpha(#FFFFFF, .6) !important
|
||||
|
||||
&:hover
|
||||
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')
|
||||
#local-search
|
||||
background: #121212
|
||||
|
||||
Reference in New Issue
Block a user