Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github badges #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fancybox: true ## If you want to use fancybox please set the value to true.
show_category_count: false ## If you want to show the count of categories in the sidebar widget please set the value to true.
toc_number: true ## If you want to add list number to toc please set the value to true.
shareto: false ## If you want to use the share button please set the value to true, and you must have hexo-helper-qrcode installed.
busuanzi: false ## If you want to use Busuanzi page views please set the value to true.
busuanzi: true ## If you want to use Busuanzi page views please set the value to true.
wordcount: false ## If you want to display the word counter and the reading time expected to spend of each post please set the value to true, and you must have hexo-wordcount installed.
widgets_on_small_screens: false ## Set to true to enable widgets on small screens.
canvas_nest:
Expand Down Expand Up @@ -115,6 +115,31 @@ timeline:
- num: 4
word: More

badges:
- lable: Powered by
message: Hexo
color: blue
url: https://hexo.io
# title: Hexo
- lable: Theme
message: Maupassant
color: yellowgreen
url: https://www.haomwei.com/technology/maupassant-hexo.html
- lable: UV
type: uv
message: <i class="fa fa-spinner fa-spin fa-fw"></i>
color: orange
- lable: PV
type: pv
message: <i class="fa fa-spinner fa-spin fa-fw"></i>
color: lightgray
# - logo: 'https://www.upyun.com/static/favicon-64x64.png' # or 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0i...wvZz4gPC9nPjwvc3ZnPg=='
# lable: CDN # <img src="data:image/svg+xml;base64,PHN2ZyB3...C9nPgogIDwvZz4KIDwvZz4KPC9zdmc+"/>PV
# message: 又拍云
# color: blue # values: brightgreen, green, yellowgreen, orange, yellow, blueviolet, pink, red, blue, grey/gray, lightgrey/lightgray
# url: https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral
# title: # for url

# Static files
js: js
css: css
Expand Down
16 changes: 16 additions & 0 deletions layout/_partial/footer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,19 @@
a(rel='nofollow', target='_blank', href='https://github.com/tufu9441/maupassant-hexo') Theme
| by
a(rel='nofollow', target='_blank', href='https://github.com/pagecho') Cho.
if theme.busuanzi
script(src='https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js', async)
div()
each v, i in theme.badges
- var type = ''
if v.type == 'pv' || v.type == 'uv'
- type = v.type
div(class="github-badge")
a(href=v.url, target='_black', rel='nofollow', title=v.title)
span(class='badge-subject') !{v.lable ? v.lable : '&nbsp;'}
span(class='badge-value bg-'+ (v.color ? v.color : 'brightgreen'), id = type ? `busuanzi_value_site_${type}` : false)
if v.logo
!= `<img src=${v.logo} />`
|!{v.message || v.logo ? v.message : '&nbsp;'}
|
|
1 change: 0 additions & 1 deletion layout/post.pug
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ block content
for category in page.categories.toArray()
a(href=url_for(category.path))= category.name
if theme.busuanzi == true
script(src='https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js', async)
span#busuanzi_container_page_pv= ' | '
span#busuanzi_value_page_pv
span= ' ' + __('Hits')
Expand Down
66 changes: 66 additions & 0 deletions source/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,72 @@ div {
}
}

.github-badge {
display: inline-block;
border-radius: 4px;
text-shadow: none;
font-size: 12px;
color: #fff;
line-height: 1.25;
background-color: #ABBAC3;
margin-bottom: 5px;
a {
color: #fff;
}
img {
/*height: "calc(%s * 1.25)" % $fontsize-footnote*/
height: 1.25em;
vertical-align: top;
}
.badge-subject {
display: inline-block;
background-color: #555;
padding: 4px 4px 4px 6px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.badge-value {
display: inline-block;
padding: 4px 6px 4px 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.bg-brightgreen {
background-color: #4c1 !important;
}
.bg-green {
background-color: #97ca00 !important;
}
.bg-yellowgreen {
background-color: #a4a61d !important;
}
.bg-orange {
background-color: #FE7D37 !important;
}
.bg-yellow {
background-color: #dfb317 !important;
}
.bg-blueviolet {
background-color: #8A2BE2 !important;
}
.bg-pink {
background-color: #FFC0CB !important;
}
.bg-red {
background-color: #e05d44 !important;
}
.bg-blue {
background-color: #007EC6 !important;
}
.bg-grey,
.bg-gray {
background-color: #555 !important;
}
.bg-lightgrey,
.bg-lightgray {
background-color: #9f9f9f !important;
}
}

/* for archive page starts*/

Expand Down