修改脚底自定义标签

2021-12-14 11:24:41 浏览数 (4)

创建样式

找到themes/butterfly/source/css/_global/function.styl文件,任意位置添加代码

样式代码可以自定义添加 示例:

代码语言:javascript复制
/*底部信息*/

.github-badge {
    margin-left: 5px;
    display: inline-block;
    border-radius: 4px;
    text-shadow: none;
    color: #fff;
    line-height: 15px;
    background-color: #abbac3;
    margin-bottom: 5px;
    font-size: 12px;
}

.github-badge .badge-subject {
    display: inline-block;
    background-color: #4d4d4d;
    padding: 4px 4px 4px 6px;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.github-badge .badge-value {
    display: inline-block;
    padding: 4px 6px 4px 4px;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.github-badge .bg-blue {
    background-color: #007ec6;
}

.github-badge .bg-brightgreen {
    background-color: #4dc820;
}

.github-badge .bg-orange {
    background-color: orange;
}

.github-badge .bg-gradient {
    background: linear-gradient(to right,#3ca5f6,#a86af9);
}

.github-badge .bg-blueviolet {
    background-color: #8833d7;
}

引用

找到themes/butterfly/layout/includes/footer.pug文件,添加下面代码即可

引用样式,可以按照格式自定义删减加

代码语言:javascript复制
.github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='https://hexo.io/', target='_blank', title='由 Hexo 强力驱动', data-pjax-state='')
      span.badge-subject Powered
      span.badge-value.bg-blue Hexo
  
  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='https://coding.net/', target='_blank', title='静态网页托管于 GitHub Pages 和 Coding Pages', data-pjax-state='')
      span.badge-subject Hosted
      span.badge-value.bg-brightgreen Coding
  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='https://github.com/', target='_blank', title='静态网页托管于 GitHub Pages 和 Coding Pages', data-pjax-state='')
      span.badge-subject Hosted
      span.badge-value.bg-brightgreen GitHub 

  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='https://www.jsdelivr.com/', target='_blank', title='jsDelivr 提供 CDN 加速服务', data-pjax-state='')
      span.badge-subject CDN
      span.badge-value.bg-orange jsDelivr
  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='http://creativecommons.org/licenses/by-nc-sa/4.0/', target='_blank', title='本站点采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可', data-pjax-state='')
      span.badge-subject
        i.fa.fa-copyright
      span.badge-value.bg-gradient BY-NC-SA 4.0

  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='https://github.com/jerryc127/hexo-theme-butterfly', target='_blank', title='主题', data-pjax-state='')
      span.badge-subject Theme
      span.badge-value.bg-blueviolet Butterfly 
  
  .github-badge
    a(style='color:#fff', rel='external nofollow noopener noreferrer', href='http://www.beian.miit.gov.cn/', target='_blank', title='备案', data-pjax-state='')
      span.badge-subject 浙ICP备
      span.badge-value.bg-orange 20027461号
  .github-badge
    span.badge-subject 本站已安全运行
    a(style='text-decoration:none;color:#fff;background:#007ec6;padding: 4px 4px 4px 6px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;width:168px;display: inline-block;',id='running-time', rel='external nofollow noopener noreferrer', href='', target='_blank', title='网站运行时间', data-pjax-state='')
  #running-time
    script.
      setInterval(()=>{let create_time=Math.round(new Date('2020-07-20 00:00:00').getTime()/1000);let timestamp=Math.round((new Date().getTime() 8*60*60*1000)/1000);let second=timestamp-create_time;let time=new Array(0,0,0,0,0);if(second>=365*24*3600){time[0]=parseInt(second/(365*24*3600));second%=365*24*3600;}if(second>=24*3600){time[1]=parseInt(second/(24*3600));second%=24*3600;}if(second>=3600){time[2]=parseInt(second/3600);second%=3600;}if(second>=60){time[3]=parseInt(second/60);second%=60;}if(second>0){time[4]=second;}currentTimeHtml=time[0] ' 年 ' time[1] '  天  ' time[2] '  时  ' time[3] '  分  ' time[4] '  秒';document.getElementById("running-time").innerHTML=currentTimeHtml;},1000);

1 人点赞