mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-08 12:07:06 +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"
|
||||
|
||||
# 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:
|
||||
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
|
||||
|
||||
# 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:
|
||||
enable: false
|
||||
@@ -168,9 +168,11 @@ post_meta:
|
||||
categories: 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:
|
||||
enable: false
|
||||
post_wordcount: true
|
||||
min2read: true
|
||||
total_wordcount: true
|
||||
|
||||
toc:
|
||||
enable: true
|
||||
@@ -313,6 +315,13 @@ google_adsense:
|
||||
client:
|
||||
enable_page_level_ads: true
|
||||
|
||||
# 廣告插入位置
|
||||
# 適用於開啓手動廣告的配置
|
||||
# ad:
|
||||
# index:
|
||||
# aside:
|
||||
# post:
|
||||
|
||||
#### 站長驗證 ####
|
||||
# Google Webmaster tools verification setting
|
||||
# See: https://www.google.com/webmasters/
|
||||
|
||||
@@ -66,6 +66,7 @@ aside:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
runtime_name: Run time
|
||||
site_wordcount: Total Count
|
||||
site_uv_name: UV
|
||||
site_pv_name: PV
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ aside:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
runtime_name: Run time
|
||||
site_wordcount: Total Count
|
||||
site_uv_name: UV
|
||||
site_pv_name: PV
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ aside:
|
||||
headline: 网站资讯
|
||||
article_name: 文章数目
|
||||
runtime_name: 已运行时间
|
||||
site_wordcount: 本站总字数
|
||||
site_uv_name: 本站访客数
|
||||
site_pv_name: 本站总访问量
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ aside:
|
||||
headline: 網站資訊
|
||||
article_name: 文章數目
|
||||
runtime_name: 已運行時間
|
||||
site_wordcount: 本站總字數
|
||||
site_uv_name: 本站訪客數
|
||||
site_pv_name: 本站總訪問量
|
||||
|
||||
|
||||
@@ -1,51 +1,63 @@
|
||||
#post-info
|
||||
#post-title
|
||||
.posttitle= page.title || _p('no_title')
|
||||
|
||||
#post-meta
|
||||
if (theme.post_meta.post.date_type)
|
||||
if (theme.post_meta.post.date_type === 'both')
|
||||
time.post-meta__date
|
||||
i.fa.fa-calendar(aria-hidden="true")
|
||||
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
||||
span.post-meta__separator |
|
||||
i.fa.fa-history(aria-hidden="true")
|
||||
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
||||
else
|
||||
- var data_type_update = theme.post_meta.post.date_type === 'updated'
|
||||
- var date_type = data_type_update ? 'updated' : 'date'
|
||||
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
|
||||
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
|
||||
time.post-meta__date
|
||||
i.fa(class=date_icon aria-hidden="true")
|
||||
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
||||
|
||||
if (theme.post_meta.post.categories && page.categories.data.length > 0)
|
||||
.meta-firstline
|
||||
if (theme.post_meta.post.date_type)
|
||||
span.post-meta__separator |
|
||||
span
|
||||
each item, index in page.categories.data
|
||||
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
|
||||
a(href=url_for(item.path)).post-meta__categories #[=item.name]
|
||||
if (index < page.categories.data.length - 1)
|
||||
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
||||
.post-meta-wordcount
|
||||
if (theme.wordcount && theme.wordcount.enable)
|
||||
- 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")
|
||||
span= _p('post.wordcount') + ':'
|
||||
span.word-count= wordcount(page.content)
|
||||
span.post-meta__separator |
|
||||
- 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")
|
||||
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)
|
||||
if (theme.post_meta.post.date_type === 'both')
|
||||
time.post-meta__date
|
||||
i.fa.fa-calendar(aria-hidden="true")
|
||||
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
||||
span.post-meta__separator |
|
||||
i.fa.fa-history(aria-hidden="true")
|
||||
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
||||
else
|
||||
- var data_type_update = theme.post_meta.post.date_type === 'updated'
|
||||
- var date_type = data_type_update ? 'updated' : 'date'
|
||||
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
|
||||
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
|
||||
time.post-meta__date
|
||||
i.fa(class=date_icon aria-hidden="true")
|
||||
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
|
||||
|
||||
if (theme.post_meta.post.categories && page.categories.data.length > 0)
|
||||
span.post-meta__categories
|
||||
if (theme.post_meta.post.date_type)
|
||||
span.post-meta__separator |
|
||||
|
||||
each item, index in page.categories.data
|
||||
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
|
||||
a(href=url_for(item.path)).post-meta__categories #[=item.name]
|
||||
if (index < page.categories.data.length - 1)
|
||||
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
||||
|
||||
.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'
|
||||
i.post-meta__icon(class=wordCountIcon aria-hidden="true")
|
||||
span= _p('post.wordcount') + ':'
|
||||
span.word-count= wordcount(page.content)
|
||||
if theme.wordcount.min2read
|
||||
span.post-meta__separator |
|
||||
if theme.wordcount.min2read
|
||||
- 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")
|
||||
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
|
||||
|
||||
.meta-thirdline
|
||||
span.post-meta-pv-cv
|
||||
if (postWordcount && theme.busuanzi.page_pv)
|
||||
span.post-meta__separator |
|
||||
if theme.busuanzi.page_pv
|
||||
i.fa.fa-eye.post-meta__icon(aria-hidden="true")
|
||||
span=_p('post.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'
|
||||
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)
|
||||
@@ -54,14 +66,14 @@
|
||||
span= _p('post.comments') + ':'
|
||||
span.disqus-comment-count.comment-count
|
||||
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)
|
||||
span.post-meta__separator |
|
||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||
span= _p('post.comments') + ':'
|
||||
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
|
||||
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)
|
||||
span.post-meta__separator |
|
||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||
|
||||
@@ -53,4 +53,9 @@ 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
|
||||
|
||||
- })
|
||||
@@ -56,4 +56,8 @@ each article , index in page.posts.data
|
||||
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
|
||||
.content!= expert
|
||||
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-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
||||
#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
|
||||
.webinfo-item
|
||||
.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})
|
||||
if theme.aside.card_recent_post
|
||||
!=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
|
||||
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
||||
if theme.aside.card_tags
|
||||
|
||||
@@ -8,13 +8,17 @@ block content
|
||||
if (theme.post_meta.post.tags)
|
||||
.post-meta__tag-list
|
||||
each item, index in page.tags.data
|
||||
a(href=url_for(item.path)).post-meta__tags #[=item.name]
|
||||
a(href=url_for(item.path)).post-meta__tags #[=item.name]
|
||||
!=partial('includes/share/index', {}, {cache:theme.fragment_cache})
|
||||
|
||||
if theme.reward.enable
|
||||
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
|
||||
|
||||
//- ad
|
||||
if theme.ad && theme.ad.post
|
||||
.post-ad!=theme.ad.post
|
||||
|
||||
include includes/pagination.pug
|
||||
|
||||
if theme.related_post && theme.related_post.enable
|
||||
!= related_posts(page,site.posts)
|
||||
if page.comments !== false
|
||||
|
||||
@@ -236,6 +236,13 @@ img:not([src])
|
||||
font-weight: 700
|
||||
font-size: 20px
|
||||
|
||||
.post-ad
|
||||
margin: 2rem 0 !important
|
||||
|
||||
.ad_height
|
||||
height: auto !important
|
||||
display: block !important
|
||||
|
||||
#content-inner,
|
||||
#footer
|
||||
animation: main 1s
|
||||
|
||||
@@ -103,6 +103,10 @@
|
||||
#post-meta
|
||||
font-size: 95%
|
||||
|
||||
> .meta-secondline,
|
||||
> .meta-thirdline
|
||||
display inline
|
||||
|
||||
.word-count,
|
||||
#busuanzi_value_page_pv,
|
||||
.comment-count
|
||||
@@ -114,10 +118,7 @@
|
||||
|
||||
&__icon
|
||||
margin-right: .2rem
|
||||
|
||||
&-pv-cv
|
||||
display: inline-block
|
||||
|
||||
|
||||
a
|
||||
color: $light-grey
|
||||
transition: all .3s ease-out
|
||||
@@ -297,11 +298,12 @@
|
||||
& > #post-meta
|
||||
font-size: 90%
|
||||
|
||||
& > span
|
||||
.post-meta__categories
|
||||
display: none
|
||||
|
||||
.post-meta-pv-cv
|
||||
|
||||
.meta-thirdline
|
||||
display: block
|
||||
|
||||
.post-meta__separator:first-child
|
||||
display: none
|
||||
.post-meta-pv-cv
|
||||
.post-meta__separator:first-child
|
||||
display: none
|
||||
Reference in New Issue
Block a user