目录
- 修改文章内链接文本样式、
- 修改底部标签样式
- 主页文章添加阴影效果
- 显示文章结束标记
- 网站底部加上访问量
- 网站底部字数统计
- 实现文章统计功能
- 添加 AddThis 分享
- 在文章底部增加版权信息
- 添加外链网易云音乐
参照简书
修改文章内链接文本样式
修改themes/next/source/css/_common/components/post/post.styl,在末尾添加如下 css 样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| .post-body p a { color: #0593d3; border-bottom: none; border-bottom: 1px solid #0593d3; &:hover { color: #fc6423; border-bottom: none; border-bottom: 1px solid #fc6423; } }
|
修改底部标签样式
修改 NexT 主题的_config.yml 文件,修改tag_icon节点值为true,即可启用fa fa-tag标签图标
主页文章添加阴影效果
在文件themes/next/source/css/_common/components/post/post.styl中,找到.post-block 处,修改 if 判断成立时里面 css 样式如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| .post-block { opacity: 0; padding: 25px; box-shadow: 0 0 5px rgba(202, 203, 203, 0.5); -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, 0.5); -moz-box-shadow: 0 0 5px rgba(202, 203, 204, 0.5); } .pagination, .comments { opacity: 0; }
|
显示文章结束标记
- 在themes/next/layout/_macro路径下新建文件passage-end-tag.swig,输入一下内容
1 2 3 4 5 6 7
| <div> {% if not is_index %} <div style="text-align:center;color: #ccc;font-size:14px;"> -------------本文结束<i class="fa fa-paw"></i>感谢您的阅读------------- </div> {% endif %} </div>
|
- 修改NexT主题目录下文件themes/next/layout/_macro/_post.swig,在END POST BODY后面添加如下文章结束标记
1 2 3
| <div> {% if not is_index %} {% include 'passage-end-tag.swig' %} {% endif %} </div>
|
网站底部加上访问量
- 修改themes/next/layout/_partials/footer.swig文件,在copyright处加上不蒜子网页计数器
1 2 3 4
| <script async src="//cdn.jsdelivr.net/gh/sukkaw/busuanzi@2.3/bsz.pure.mini.js" ></script>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <div class="powered-by"> <i class="fa fa-user-md"></i> <span id="busuanzi_container_site_uv"> 本站访客数:<span id="busuanzi_value_site_uv"></span> </span> </div>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_pv"> 本站总访问量<span id="busuanzi_value_site_pv"></span>次 </span>
<span id="busuanzi_container_site_uv"> 本站总访问量<span id="busuanzi_value_site_uv"></span>次 </span>
|
网站底部字数统计
1
| > npm install hexo-wordcount --save
|
- 在文件themes/next/layout/_partials/footer.swig末尾添加如下内容
1 2 3 4 5
| <span class="post-meta-divider">|</span> <div class="theme-info"> <div class="powered-by"></div> <span class="post-count">博客全站共{{ totalcount(site) }}字</span> </div>
|
实现文章统计功能
- 安装
hexo-symbols-count-time插件,详细说明请查看GitHub
1
| > npm install hexo-symbols-count-time --save
|
- 配置博客根目录下的_config.yml 添加文件节点symbols-count-time如下,开启文章统计功能
1 2 3 4 5 6 7 8 9
| symbols_count_time: symbols: true time: true total_symbols: true total_time: true exclude_codeblock: false awl: 2 wpm: 275 suffix: "mins."
|
添加 AddThis 分享
修改NexT主题目录下面的themes/next/_config.yml文件,在add_this_id节点添加个人的AddThis注册 Id
1
| add_this_id: { your_AddThis_pubid }
|
在文章底部增加版权信息
找到 NexT 主题目录下的_config.yml 文件,修改节点creative_commons,启用文章版权信息说明
1 2 3 4 5
| creative_commons: license: by-nc-sa sidebar: true post: true language: zh-CN
|
添加外链网易云音乐
- 打开网易云音乐,选择自己创作的歌单生成外链播放器,得到以下 iframe 代码
1 2 3 4 5 6 7 8 9
| <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="110" src="//music.163.com/outchain/player?type=0&id=818429766&auto=1&height=90" ></iframe>
|
1 2 3
| netease_music: enable: true
|
- 根据上面渲染配置项是否开启,将网易云 iframe 代码贴在合适位置,比如文件themes/next/layout/_macro/sidebar.swig的sidebar-inner容器最下面
1 2 3 4 5 6 7 8 9 10 11
| {%- if theme.netease_music.enable %} <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="110" src="//music.163.com/outchain/player?type=0&id=818429766&auto=1&height=90" ></iframe> {%- endif %}
|