mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
✨ feat: 增加手動廣告位置
✨ feat: aside info 裏添加本站總文字 🎨 refactor: post-meta代碼結構
This commit is contained in:
17
_config.yml
17
_config.yml
@@ -70,7 +70,7 @@ algolia_search:
|
|||||||
hits_stats: "${hits} results found in ${time} ms"
|
hits_stats: "${hits} results found in ${time} ms"
|
||||||
|
|
||||||
# Local search
|
# Local search
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#本地搜索
|
# Please see doc for more details: https://docs.jerryc.me/config.html#本地搜索
|
||||||
# ---------------
|
# ---------------
|
||||||
local_search:
|
local_search:
|
||||||
enable: false
|
enable: false
|
||||||
@@ -79,7 +79,7 @@ local_search:
|
|||||||
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
||||||
|
|
||||||
# MathJax
|
# MathJax
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#MathJax
|
# Please see doc for more details: https://docs.jerryc.me/config.html#mathjax
|
||||||
# ---------------
|
# ---------------
|
||||||
mathjax:
|
mathjax:
|
||||||
enable: false
|
enable: false
|
||||||
@@ -168,9 +168,11 @@ post_meta:
|
|||||||
categories: true # true or false 文章頁是否顯示分類
|
categories: true # true or false 文章頁是否顯示分類
|
||||||
tags: true # true or false 文章頁是否顯示標籤
|
tags: true # true or false 文章頁是否顯示標籤
|
||||||
|
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#字數統計
|
# Please see doc for more details: https://docs.jerryc.me/config.html#字數統計
|
||||||
wordcount:
|
wordcount:
|
||||||
enable: false
|
post_wordcount: true
|
||||||
|
min2read: true
|
||||||
|
total_wordcount: true
|
||||||
|
|
||||||
toc:
|
toc:
|
||||||
enable: true
|
enable: true
|
||||||
@@ -313,6 +315,13 @@ google_adsense:
|
|||||||
client:
|
client:
|
||||||
enable_page_level_ads: true
|
enable_page_level_ads: true
|
||||||
|
|
||||||
|
# 廣告插入位置
|
||||||
|
# 適用於開啓手動廣告的配置
|
||||||
|
# ad:
|
||||||
|
# index:
|
||||||
|
# aside:
|
||||||
|
# post:
|
||||||
|
|
||||||
#### 站長驗證 ####
|
#### 站長驗證 ####
|
||||||
# Google Webmaster tools verification setting
|
# Google Webmaster tools verification setting
|
||||||
# See: https://www.google.com/webmasters/
|
# See: https://www.google.com/webmasters/
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ aside:
|
|||||||
headline: Info
|
headline: Info
|
||||||
article_name: Article
|
article_name: Article
|
||||||
runtime_name: Run time
|
runtime_name: Run time
|
||||||
|
site_wordcount: Total Count
|
||||||
site_uv_name: UV
|
site_uv_name: UV
|
||||||
site_pv_name: PV
|
site_pv_name: PV
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ aside:
|
|||||||
headline: Info
|
headline: Info
|
||||||
article_name: Article
|
article_name: Article
|
||||||
runtime_name: Run time
|
runtime_name: Run time
|
||||||
|
site_wordcount: Total Count
|
||||||
site_uv_name: UV
|
site_uv_name: UV
|
||||||
site_pv_name: PV
|
site_pv_name: PV
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ aside:
|
|||||||
headline: 网站资讯
|
headline: 网站资讯
|
||||||
article_name: 文章数目
|
article_name: 文章数目
|
||||||
runtime_name: 已运行时间
|
runtime_name: 已运行时间
|
||||||
|
site_wordcount: 本站总字数
|
||||||
site_uv_name: 本站访客数
|
site_uv_name: 本站访客数
|
||||||
site_pv_name: 本站总访问量
|
site_pv_name: 本站总访问量
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ aside:
|
|||||||
headline: 網站資訊
|
headline: 網站資訊
|
||||||
article_name: 文章數目
|
article_name: 文章數目
|
||||||
runtime_name: 已運行時間
|
runtime_name: 已運行時間
|
||||||
|
site_wordcount: 本站總字數
|
||||||
site_uv_name: 本站訪客數
|
site_uv_name: 本站訪客數
|
||||||
site_pv_name: 本站總訪問量
|
site_pv_name: 本站總訪問量
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#post-info
|
#post-info
|
||||||
#post-title
|
#post-title
|
||||||
.posttitle= page.title || _p('no_title')
|
.posttitle= page.title || _p('no_title')
|
||||||
|
|
||||||
#post-meta
|
#post-meta
|
||||||
|
.meta-firstline
|
||||||
if (theme.post_meta.post.date_type)
|
if (theme.post_meta.post.date_type)
|
||||||
if (theme.post_meta.post.date_type === 'both')
|
if (theme.post_meta.post.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
@@ -20,32 +22,42 @@
|
|||||||
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
||||||
|
|
||||||
if (theme.post_meta.post.categories && page.categories.data.length > 0)
|
if (theme.post_meta.post.categories && page.categories.data.length > 0)
|
||||||
|
span.post-meta__categories
|
||||||
if (theme.post_meta.post.date_type)
|
if (theme.post_meta.post.date_type)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
span
|
|
||||||
each item, index in page.categories.data
|
each item, index in page.categories.data
|
||||||
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
|
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
|
||||||
a(href=url_for(item.path)).post-meta__categories #[=item.name]
|
a(href=url_for(item.path)).post-meta__categories #[=item.name]
|
||||||
if (index < page.categories.data.length - 1)
|
if (index < page.categories.data.length - 1)
|
||||||
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
||||||
.post-meta-wordcount
|
|
||||||
if (theme.wordcount && theme.wordcount.enable)
|
.meta-secondline
|
||||||
|
- let postWordcount = theme.wordcount.post_wordcount || theme.wordcount.min2read
|
||||||
|
if (postWordcount)
|
||||||
|
span.post-meta-wordcount
|
||||||
|
if theme.wordcount.post_wordcount
|
||||||
- var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o'
|
- var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o'
|
||||||
i.post-meta__icon(class=wordCountIcon aria-hidden="true")
|
i.post-meta__icon(class=wordCountIcon aria-hidden="true")
|
||||||
span= _p('post.wordcount') + ':'
|
span= _p('post.wordcount') + ':'
|
||||||
span.word-count= wordcount(page.content)
|
span.word-count= wordcount(page.content)
|
||||||
|
if theme.wordcount.min2read
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
|
if theme.wordcount.min2read
|
||||||
- var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o'
|
- var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o'
|
||||||
i.post-meta__icon(class=readCountIcon aria-hidden="true")
|
i.post-meta__icon(class=readCountIcon aria-hidden="true")
|
||||||
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
|
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
|
||||||
.post-meta-pv-cv
|
|
||||||
if (theme.wordcount && theme.wordcount.enable && theme.busuanzi.page_pv)
|
.meta-thirdline
|
||||||
|
span.post-meta-pv-cv
|
||||||
|
if (postWordcount && theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
if theme.busuanzi.page_pv
|
if theme.busuanzi.page_pv
|
||||||
i.fa.fa-eye.post-meta__icon(aria-hidden="true")
|
i.fa.fa-eye.post-meta__icon(aria-hidden="true")
|
||||||
span=_p('post.page_pv') + ':'
|
span=_p('post.page_pv') + ':'
|
||||||
span#busuanzi_value_page_pv
|
span#busuanzi_value_page_pv
|
||||||
|
|
||||||
|
span.post-meta-commentcount
|
||||||
- var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o'
|
- var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o'
|
||||||
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false))
|
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false))
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (theme.busuanzi && theme.busuanzi.page_pv)
|
||||||
@@ -54,14 +66,14 @@
|
|||||||
span= _p('post.comments') + ':'
|
span= _p('post.comments') + ':'
|
||||||
span.disqus-comment-count.comment-count
|
span.disqus-comment-count.comment-count
|
||||||
a(href=full_url_for(page.path) + '#disqus_thread')
|
a(href=full_url_for(page.path) + '#disqus_thread')
|
||||||
if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
|
else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (theme.busuanzi && theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
span= _p('post.comments') + ':'
|
span= _p('post.comments') + ':'
|
||||||
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
|
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
|
||||||
span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount")
|
span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount")
|
||||||
if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
|
else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (theme.busuanzi && theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
|
|||||||
@@ -53,4 +53,9 @@ mixin UI_NEW(posts)
|
|||||||
.content!= expert
|
.content!= expert
|
||||||
else
|
else
|
||||||
.content!= article.description
|
.content!= article.description
|
||||||
|
|
||||||
|
if theme.ad && theme.ad.index
|
||||||
|
if (index + 1) % 3 == 0
|
||||||
|
.recent-post-item.ad_height!=theme.ad.index
|
||||||
|
|
||||||
- })
|
- })
|
||||||
@@ -57,3 +57,7 @@ each article , index in page.posts.data
|
|||||||
.content!= expert
|
.content!= expert
|
||||||
else
|
else
|
||||||
.content!= article.description
|
.content!= article.description
|
||||||
|
|
||||||
|
if theme.ad && theme.ad.index
|
||||||
|
if (index + 1) % 3 == 0
|
||||||
|
.recent-post-item.ad_height!=theme.ad.index
|
||||||
|
|||||||
2
layout/includes/widget/card_ad.pug
Normal file
2
layout/includes/widget/card_ad.pug
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.card-widget.card-ad
|
||||||
|
!= theme.ad.aside
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
||||||
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
||||||
|
if theme.wordcount.total_wordcount
|
||||||
|
.webinfo-item
|
||||||
|
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
|
||||||
|
.webinfo-site-wordcount=totalcount(site)
|
||||||
if theme.busuanzi.site_uv
|
if theme.busuanzi.site_uv
|
||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :"
|
.webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :"
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ if theme.aside.enable
|
|||||||
!=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_recent_post
|
if theme.aside.card_recent_post
|
||||||
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
|
||||||
|
if theme.ad && theme.ad.aside
|
||||||
|
!=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_categories
|
if theme.aside.card_categories
|
||||||
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_tags
|
if theme.aside.card_tags
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ block content
|
|||||||
|
|
||||||
if theme.reward.enable
|
if theme.reward.enable
|
||||||
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
|
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
|
||||||
include includes/pagination.pug
|
|
||||||
|
|
||||||
|
//- ad
|
||||||
|
if theme.ad && theme.ad.post
|
||||||
|
.post-ad!=theme.ad.post
|
||||||
|
|
||||||
|
include includes/pagination.pug
|
||||||
if theme.related_post && theme.related_post.enable
|
if theme.related_post && theme.related_post.enable
|
||||||
!= related_posts(page,site.posts)
|
!= related_posts(page,site.posts)
|
||||||
if page.comments !== false
|
if page.comments !== false
|
||||||
|
|||||||
@@ -236,6 +236,13 @@ img:not([src])
|
|||||||
font-weight: 700
|
font-weight: 700
|
||||||
font-size: 20px
|
font-size: 20px
|
||||||
|
|
||||||
|
.post-ad
|
||||||
|
margin: 2rem 0 !important
|
||||||
|
|
||||||
|
.ad_height
|
||||||
|
height: auto !important
|
||||||
|
display: block !important
|
||||||
|
|
||||||
#content-inner,
|
#content-inner,
|
||||||
#footer
|
#footer
|
||||||
animation: main 1s
|
animation: main 1s
|
||||||
|
|||||||
@@ -103,6 +103,10 @@
|
|||||||
#post-meta
|
#post-meta
|
||||||
font-size: 95%
|
font-size: 95%
|
||||||
|
|
||||||
|
> .meta-secondline,
|
||||||
|
> .meta-thirdline
|
||||||
|
display inline
|
||||||
|
|
||||||
.word-count,
|
.word-count,
|
||||||
#busuanzi_value_page_pv,
|
#busuanzi_value_page_pv,
|
||||||
.comment-count
|
.comment-count
|
||||||
@@ -115,9 +119,6 @@
|
|||||||
&__icon
|
&__icon
|
||||||
margin-right: .2rem
|
margin-right: .2rem
|
||||||
|
|
||||||
&-pv-cv
|
|
||||||
display: inline-block
|
|
||||||
|
|
||||||
a
|
a
|
||||||
color: $light-grey
|
color: $light-grey
|
||||||
transition: all .3s ease-out
|
transition: all .3s ease-out
|
||||||
@@ -297,11 +298,12 @@
|
|||||||
& > #post-meta
|
& > #post-meta
|
||||||
font-size: 90%
|
font-size: 90%
|
||||||
|
|
||||||
& > span
|
.post-meta__categories
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
.post-meta-pv-cv
|
.meta-thirdline
|
||||||
display: block
|
display: block
|
||||||
|
|
||||||
|
.post-meta-pv-cv
|
||||||
.post-meta__separator:first-child
|
.post-meta__separator:first-child
|
||||||
display: none
|
display: none
|
||||||
Reference in New Issue
Block a user