diff --git a/_config.yml b/_config.yml
index 7d13217..f3253fa 100644
--- a/_config.yml
+++ b/_config.yml
@@ -126,8 +126,6 @@ cdn:
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js
js-cookies: https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js
- lozy: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
-
# Post info settings
# ---------------
@@ -376,10 +374,11 @@ hr:
subtitle:
enable: true
sub1: 今日事,今日畢
- sub2: Never put off till tomorrow what you can do today
+ sub2: Never put off till tomorrow what you can do today #如果有符號 ' ,記得前面加上 \
#側邊欄顯示設置
aside:
+ position: right # left or right
card_author: true
card_announcement: true
card_recent_post: true
@@ -417,4 +416,23 @@ baidu_push:
#https://instant.page/
#prefetch預加載
instantpage:
- enable: true
\ No newline at end of file
+ enable: true
+
+note:
+ # Note tag style values:
+ # - simple bs-callout old alert style. Default.
+ # - modern bs-callout new (v2-v3) alert style.
+ # - flat flat callout style with background, like on Mozilla or StackOverflow.
+ # - disabled disable all CSS styles import of note tag.
+ style: simple
+ icons: true
+ border_radius: 3
+ # Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
+ # Offset also applied to label tag variables. This option can work with disabled note tag.
+ light_bg_offset: 0
+
+
+#圖片懶加載
+lazyload:
+ enable: true
+ script: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
\ No newline at end of file
diff --git a/layout/flink.pug b/layout/flink.pug
index 4b39f62..de257c7 100644
--- a/layout/flink.pug
+++ b/layout/flink.pug
@@ -6,7 +6,10 @@
each item in i.link_list
li.md-links-item
a(href=item.link title=item.name target="_blank")
- img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
+ if theme.lazyload.enable
+ img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
+ else
+ img(src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
div(class="md-links-title")= item.name
div(class="md-links-des")=item.descr
diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug
index a9020e2..00153b0 100644
--- a/layout/includes/additional-js.pug
+++ b/layout/includes/additional-js.pug
@@ -90,3 +90,9 @@ if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
if theme.instantpage.enable
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module")
+
+if theme.lazyload.enable
+ script(src=url_for(theme.lazyload.script))
+ script.
+ const observer = lozad(); // lazy loads elements with default selector as '.lozad'
+ observer.observe();
diff --git a/layout/includes/comments/disqus.pug b/layout/includes/comments/disqus.pug
index a1bd151..1e0c01c 100644
--- a/layout/includes/comments/disqus.pug
+++ b/layout/includes/comments/disqus.pug
@@ -1,4 +1,4 @@
-if theme.disqus.enable
+if theme.disqus && theme.disqus.enable
#disqus_thread
script.
var unused = null;
diff --git a/layout/includes/comments/index.pug b/layout/includes/comments/index.pug
index 6a8bedd..bdb057d 100644
--- a/layout/includes/comments/index.pug
+++ b/layout/includes/comments/index.pug
@@ -1,35 +1,35 @@
-if theme.disqus.enable
+if theme.disqus && theme.disqus.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
- span= _p('comment')
+ span= ' ' + _p('comment')
include ./disqus.pug
else if theme.laibili && theme.laibili.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
- span= _p('comment')
+ span= ' ' + _p('comment')
include ./laibili.pug
else if theme.gitment && theme.gitment.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
- span= _p('comment')
+ span= ' ' + _p('comment')
include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
- span= _p('comment')
+ span= ' ' + _p('comment')
include ./gitalk.pug
else if theme.valine && theme.valine.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
- span= _p('comment')
+ span= ' ' + _p('comment')
include ./valine.pug
\ No newline at end of file
diff --git a/layout/includes/header.pug b/layout/includes/header.pug
index de2d802..bc88f99 100644
--- a/layout/includes/header.pug
+++ b/layout/includes/header.pug
@@ -9,7 +9,7 @@
span.pull-right.menus
.mobile_author_icon
- img.lozad(data-src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
+ img.lozad(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
.mobile_author-info__description= config.description
hr
.menus_item
diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug
index 765e99d..3d3ded0 100644
--- a/layout/includes/layout.pug
+++ b/layout/includes/layout.pug
@@ -66,14 +66,12 @@ html(lang=config.language)
div!= body
else
block content
- //- - var top_img = page.top_img || theme.post_meta.top_img || theme.top_img || config.top_img || true
- //- - var bg_img = top_img !== true ? `background-image: url(${top_img})` : ''
- //- - var footer_bg_class= bg_img ? 'footer-bg' : ''
- //- footer(style=bg_img class=footer_bg_class)
footer
include ./footer.pug
i.fa.fa-arrow-up#go-up(aria-hidden="true")
include ./rightside.pug
+ if (is_post())
+ include ./post-bottom.pug
each item in theme.cdn.js
if item !== undefined
script(src=url_for(item))
diff --git a/layout/includes/pagination.pug b/layout/includes/pagination.pug
index bfd5628..a0ba097 100644
--- a/layout/includes/pagination.pug
+++ b/layout/includes/pagination.pug
@@ -16,7 +16,11 @@ else
.prev-post.pull-left
- var pagination_cover = page.prev.cover || random_cover()
a(href=url_for(page.prev.path))
- img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
+ if theme.lazyload.enable
+ img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
+ else
+ img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
+
.label=_p('pagination.prev')
.prev_info
span=page.prev.title
@@ -24,19 +28,23 @@ else
.prev-post.pull-full
- var pagination_cover = page.prev.cover || random_cover()
a(href=url_for(page.prev.path))
- img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.prev')
.prev_info
span=page.prev.title
-
-
if(page.next)
if(page.prev)
.next-post.pull-right
- var pagination_cover = page.next.cover || random_cover()
a(href=url_for(page.next.path))
- img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
@@ -44,7 +52,10 @@ else
.next-post.pull-full
- var pagination_cover = page.next.cover || random_cover()
a(href=url_for(page.next.path))
- img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
diff --git a/layout/includes/post-bottom.pug b/layout/includes/post-bottom.pug
new file mode 100644
index 0000000..6d8427b
--- /dev/null
+++ b/layout/includes/post-bottom.pug
@@ -0,0 +1,8 @@
+#post_bottom
+ #post_bottom_items
+ a#to_comment(href="#post-comment")
+ i.scroll_to_comment.fa.fa-comments
+ i#mobile_toc.fa.fa-list
+ #toc_mobile
+ .toc_mobile_headline= _p('sidebar.catalog')
+ !=toc(page.content,{"class":"toc_mobile_items"})
diff --git a/layout/includes/recent-posts.pug b/layout/includes/recent-posts.pug
index e13e3cd..77d66fb 100644
--- a/layout/includes/recent-posts.pug
+++ b/layout/includes/recent-posts.pug
@@ -7,19 +7,30 @@ each article , index in page.posts.data
- var post_cover = article.cover
- var default_post_cover = random_cover()
if (post_cover)
- img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
- img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
.post_cover.is_right
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
- var default_post_cover = random_cover()
if (post_cover)
- img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ if theme.lazyload.enable
+ img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
- img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
-
+ if theme.lazyload.enable
+ img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
+ else
+ img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.recent-post-info
a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title')
if (article.top)
diff --git a/layout/includes/reward.pug b/layout/includes/reward.pug
index 57d26ba..f8c7b7e 100644
--- a/layout/includes/reward.pug
+++ b/layout/includes/reward.pug
@@ -6,60 +6,6 @@
ul.reward-all
each item in theme.reward.QR_code
li.reward-item
- img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
+ img.lozad.post-qr-code__img(src=(item.itemlist||item).img)
.post-qr-code__desc=(item.itemlist||item).text
-
-
-//- donate-share样式1
-//- .post-reward-share
-//- .post-reward
-//- a.reward-buttom
-//- i.fa.fa-qrcode
-//- = ' ' + _p('donate')
-//- .reward-main
-//- ul.reward-all
-//- each item in theme.QR_code
-//- li.reward-item
-//- img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
-//- .post-qr-code__desc=(item.itemlist||item).text
-
-//- .post-share
-//- include share/index.pug
-//- a.share-buttom
-//- i.fa.fa-share-alt
-//- = ' ' + _p('share')
-
-//- donate-share样式1
-//- #social
-//- .social-main
-//- span.social-donate
-//- a#social-donate
-//- i.fa.fa-qrcode
-//- = _p('donate')
-
-
-//- .circle
-//- .circle-empty
-//- span
-//- span.circle_item
-//- a(style="cursor:pointer")
-
-//- .social-sharebutton
-//- span.share-s
-//- a(href="javascript:void(0)" id="share-s" title=_p('share'))
-//- i.fa.fa-share-alt
-//- = _p('share')
-//- include share/index.pug
-
-
-//- if (theme.QR_code)
-//- if (theme.QR_code.length > 0)
-//- .post-qr-code
-//- each item in theme.QR_code
-//- .post-qr-code-item
-//- img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
-//- .post-qr-code__desc=(item.itemlist||item).text
-
-
-
diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug
index 9f93e71..b31fff2 100644
--- a/layout/includes/widget/card_author.pug
+++ b/layout/includes/widget/card_author.pug
@@ -2,7 +2,7 @@
.card-content
.post_data
.data-item.text-center
- img.lozad(data-src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
+ img.lozad(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
p.author-info__name.text-center= config.author
p.author-info__description.text-center= config.description
diff --git a/layout/includes/widget/card_recent_post.pug b/layout/includes/widget/card_recent_post.pug
index f07e9f0..671187c 100644
--- a/layout/includes/widget/card_recent_post.pug
+++ b/layout/includes/widget/card_recent_post.pug
@@ -12,9 +12,15 @@
- var default_post_cover = random_cover()
.aside_post_cover
if (post_cover)
- img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
+ if theme.lazyload.enable
+ img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
+ else
+ img.aside_post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
else
- img.aside_post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
+ if theme.lazyload.enable
+ img.aside_post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
+ else
+ img.aside_post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
div#aside_title
.aside_post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
if (theme.post_meta.date_type)
diff --git a/scripts/note.js b/scripts/note.js
new file mode 100644
index 0000000..61acd3b
--- /dev/null
+++ b/scripts/note.js
@@ -0,0 +1,15 @@
+/**
+ * note.js
+ * transplant from hexo-theme-next
+ */
+
+'use strict';
+
+function postNote(args, content) {
+ return `