Butterfly美化

首先提示,本文量特别大哦!基本上有所有的美化,还在持续更新ing,谨慎入坑.........

主题配置文件修改

基础配置

最最最开始的,好不容易搭建了自己的个人博客,当然要写上自己的名字、签名......,证明身份。而且身为一个Chinese,还是中文舒服,所以主目录下_config.yml的配置文件:

  1. # Site
  2. title: FATE #标题名字
  3. subtitle: ''
  4. description: '' #签名
  5. keywords:
  6. author: MoYu-zc #作者名字
  7. language: zh-CN #默认en 可以改为这个
  8. timezone: ''

主题支持以下三种语言:

  • default(en)
  • zh-CN (简体中文)
  • zh-TW (繁体中文)


导航栏修改

主目录下\source\_data--butterfly.yml:

(如果没有这个文件夹,创建一个_data,把\themes\butterfly也就是主题文件夹下的_config.yml移动到_data文件夹下,重命名为butterfly.yml,以后只需要修改这个文件。这样为了留个备份,你搞坏了配置,还可以重新换成最开始的状态) ↓: 名称: /xxxx/ || 图标

  1. menu:
  2. 首页: / || fa fa-home
  3. 归档: /archives/ || fa fa-archive
  4. 标签: /tags/ || fa fa-tags
  5. 分类: /categories/ || fa fa-folder-open
  6. 留言板: /messageboard/ || fa fa-paper-plane
  7. 友链: /link/ || fa fa-link
  8. 日志: /timeline/ || fa fa-bell
  9. 菜单 || fa fa-list:
  10. - 关于 || /about/ || fa fa-sitemap
  11. - myself || /myself/ || fa fa-id-card
  12. - butterfly主题 || https://github.com/jerryc127/hexo-theme-butterfly/ || fa fa-heart

代码块样式

主目录下/source/_data--butterfly.yml:

  1. ## 代码块样式
  2. highlight_theme: mac #default/darker/pale night/light/ocean/mac /false/ 前面的参数任选一项为代码块显示效果
  3. highlight_copy: true # copy button 是否显示复制按钮
  4. highlight_lang: true # show the code language 是否显示代码块语言
  5. highlight_shrink: false #true:打开文章默认折叠代码块内容/false:打开文章默认展开代码块/none:关闭代码折叠按钮
  6. code_word_wrap: false # 关闭滚动条

然后找到 Hexo 配置文件_config.yml,将line_number改成false:

  1. highlight:
  2. enable: true
  3. line_number: false # 改为false
  4. auto_detect: false
  5. tab_replace:

本地搜索

  1. # Local search 本地搜索
  2. local_search:
  3. enable: true
  4. labels:
  5. input_placeholder: Search for Posts
  6. hits_empty: "We didn't find any results for the search: ${query}" # 如果没有查到内容相关内容显示

需要安装插件,不然hexo g直接报错:

  1. npm install hexo-generator-search --save

分割线图标更换

本次修改基于Butterfly主题 3.0.0 !

将图标更换为“太空飞船”。

修改butterfly主题配置文件_data--_config.yml

  1. hr_icon:
  2. enable: true
  3. icon: '\f197' # the unicode value of Font Awesome icon
  4. icon-top: -10px

icon-top常用数值:

-20px:图标位于分割线上方

-10px:图标位于分割线中间

0px:图标位于分割线下方

创建标签文件夹

会在\source中创建对应的文件夹index.md

1.归档

这个页面不用创建,自动已经带了

2.标签

命令行输入:

  1. hexo new page tags

出现source/tags/index.md文件:

  1. ---
  2. title: 标签
  3. date: 2018-01-05 00:00:00
  4. type: "tags"
  5. ---

以后上传文章的md文件中,可以在标题头中加入tags,包含 标签 文章的例子:

  1. ---
  2. title: 标签测试
  3. tags:
  4. - 1111 (这个就是文章的标签了)
  5. - 2222 (这个就是文章的标签了)
  6. ---

3.分类

命令行输入:

  1. hexo new page categories

出现source/categories/index.md文件:

  1. ---
  2. title: 分类
  3. date: 2018-01-05 00:00:00
  4. type: "categories"
  5. ---

以后上传文章的md文件中,可以在标题头中加入categories,包含 分类 文章的例子:

  1. ---
  2. title: 分类测试
  3. categories:
  4. - 1111 (这个就是文章的分类了)
  5. - 2222 (这个就是文章的分类了)
  6. ---

4.留言板

命令行输入:

  1. hexo new page messageboard

出现source/messageboard/index.md文件:

  1. ---
  2. title: 留言板
  3. date: 2018-01-05 00:00:00
  4. type: "messageboard"
  5. ---

5.友链

5.1、创建友情链接页面

命令行输入:

  1. hexo new page link

出现source/link/index.md文件:

  1. ---
  2. title: 友链
  3. date: 2018-01-05 00:00:00
  4. type: "link"
  5. ---
5.2、友情链接添加

在Hexo目录中的source/_data,创建一个文件link.yml,内容如下:

  1. class:
  2. class_name: 友情链接
  3. link_list:
  4. 1:
  5. name: 姓名
  6. link: 链接
  7. avatar: 图片
  8. descr: 签名
  9. 2:
  10. name: 姓名
  11. link: 链接
  12. avatar: 图片
  13. descr: 签名

6.日志

命令行输入:

  1. hexo new page timeline

出现source/timeline/index.md文件:

  1. ---
  2. title: 日志
  3. date: 2018-01-05 00:00:00
  4. type: "timeline"
  5. ---

7.关于

命令行输入:

  1. hexo new page about

出现source/about/index.md文件:

  1. ---
  2. title: 关于
  3. date: 2018-01-05 00:00:00
  4. type: "about"
  5. ---

8.myself

命令行输入:

  1. hexo new page myself

出现source/myself/index.md文件:

  1. ---
  2. title: This is me
  3. date: 2018-01-05 00:00:00
  4. type: "myself"
  5. ---

标题样式

1.副标题设置

如果没设置副标题,上面的description:签名,就是显示在主页面。而设置的话,签名自动不显示,副标题出现。

\source\_data中的butterfly.yml:

  1. subtitle:
  2. enable: true
  3. sub:
  4. - 何其荣幸 何德何能
  5. - 所有的不平凡都来自平凡

这个他们可以设置以下,打字效果可以开启,个人感觉不错,但是需要注意:

  1. # 如果有英文逗號' , ',請使用转义字元 ,
  2. # 如果有英文雙引號' " ',請使用转义字元 "
  3. # 開頭不允許轉義字元,如需要,請把整個句子用双引号包住
  4. # 如果關閉打字效果,subtitle只会显示sub的第一行文字

我尝试了转义字符,但是会到“,”时,可能会有点卡,可以用空格代替。

2.副标题字体大小颜色

\themes\butterfly\source\css\_layout中的head.styl:

  1. #site-subtitle
  2. color: var(--white) 此处修改为白色
  3. font-size: 1.05em 字体大小
  4. +minWidth768()
  5. font-size: 1.40em 字体大小

图片设置

图片可以使用网上的图片(即使用该图片链接),也可以使用\themes\butterfly\source\img下的图片。

1.网站图标

  1. # Favicon(网站图标)
  2. favicon: /img/favicon.png

2.头像

  1. # Avatar (头像)
  2. avatar:
  3. img: /img/tit.png
  4. effect: false

3.主页面图片

  1. # The banner image of home page (主页的横幅图像)
  2. index_img: /img/index_img.jpg

4.子标签页图片

  1. # The banner image of archive page
  2. archive_img: /img/tag.jpg

5.推荐

  1. 主页的顶部图可以在butterfly.yml设置index_img
  2. ``archives页的顶部图可以在Butterfly.yml设置archive_img`
  3. 其他page页的顶部图可以在各自的md页面设置front-matter中的top_img
  1. favicon: /img/favicon.png
  2. avatar:
  3. img: /img/tit.png
  4. effect: false
  5. index_img: /img/index_img.jpg
  6. default_top_img: /img/tag.jpg #这个推荐:不加入可能部分标签页不出现图片
  7. archive_img: /img/tag.jpg
  8. tag_img: /img/tag.jpg
  9. category_img: /img/tag.jpg


6.文章列表图片

\source\_data中的butterfly.yml修改:

  1. cover:
  2. # display the cover or not (是否顯示文章封面)
  3. index_enable: true
  4. aside_enable: true
  5. archives_enable: true
  6. # the position of cover in home page (封面顯示的位置)
  7. # left/right/both
  8. position: both
  9. default_cover:

文章封面设置:

一个:

  1. default_cover: https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

多个:

此时会随机选择一张。

  1. default_cover:
  2. - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg
  3. - https://upimage.alexhchu.com/2020/10/21/671e773d973ae.jpg
  4. - https://upimage.alexhchu.com/2020/10/21/f5ac68ddaaf64.jpg
  5. - https://upimage.alexhchu.com/2020/10/21/5fecb0b094b73.jpg

or文章内

7.图片查看大图

主目录下/source/_data--butterfly.yml:

这是两种方式只能选择一个 或者 两个都不选

8.图片懒加载

1.新增hexo-lazyload-image模块

  1. npm install hexo-lazyload-image --save

2.在主目录配置文件_config.yml增加配置

  1. lazyload:
  2. enable: true
  3. loadingImg: /img/loading.gif

这个就是图片没加载出来的时候,出现一个动图转转转。

文章页样式

1.复制的内容后面加上版权信息

  1. # copy settings
  2. # copyright: Add the copyright information after copied content (复制的内容后面加上版权信息)
  3. copy:
  4. enable: true

(↑这个相信大家都见过,不演示了)

2.文章版权信息

在底部会出现对应的作者、链接、声明

\source\_data中的butterfly.yml修改:

  1. post_copyright:
  2. enable: true
  3. decode: true
  4. license: CC BY-NC-SA 4.0
  5. license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/

3.TOC目录

在文章页,会有一个目录,用于顯示TOC。

\source\_data中的butterfly.yml修改:

  1. # toc (目錄)
  2. toc:
  3. enable: true
  4. number: true
  5. auto_open: true # auto open the sidebar

4.相关文章

在文章最下面,会出现相关信息文章的推送。

\source\_data中的butterfly.yml修改:

  1. # Related Articles
  2. related_post:
  3. enable: true
  4. limit: 6 # Number of posts displayed 显示的文章数
  5. date_type: created # or created or updated 文章日期顯示創建日或者更新日

5.打赏

在你每篇文章的結尾,可以添加打赏按鈕。对应二維碼可以自行配置。

没有提供二维码的,可配置icon图片,然后在link上添加相应的打赏链接。用户点击图片就会跳转到对应链接去。

link可以不写,会默认为图片的链接。

\source\_data中的butterfly.yml修改:

  1. # Sponsor/reward
  2. reward:
  3. enable: false
  4. QR_code:
  5. - img: /img/wechat.jpg
  6. link:
  7. text: wechat
  8. - img: /img/alipay.jpg
  9. link:
  10. text: alipay

侧边框样式

1.侧边框出现位置

\source\_databutterfly.yml修改:

  1. # aside (側邊欄)
  2. # --------------------------------------
  3. aside:
  4. enable: true
  5. mobile: true # display on mobile
  6. position: left # left or right

left:侧边框出现在左侧

right::侧边框出现在右侧

2.Follow me信息修改

\source\_databutterfly.yml修改:

图中icon图标使用的阿里iconfont图标

具体可参考:本站文章--Hexo-使用阿里iconfont图标

3.公告

\source\_databutterfly.yml修改:

  1. card_announcement:
  2. enable: true
  3. content: This is my Blog #修改此处

4.访问人數和运行时间

  1. # 訪問人數
  2. busuanzi:
  3. site_uv: true
  4. site_pv: true
  5. page_pv: true
  6. # 網頁運行時間
  7. runtimeshow:
  8. enable: true
  9. publish_date: 10/11/2020 00:00:00
  10. #格式: 月/日/年 時間
  11. #也可以 年/月/日 時間

特效部分

1.鼠标点击特效

\source\_databutterfly.yml修改:

2.鼠标移动特效

\themes\butterfly\source\css中创建一个css文件,将以下代码复制进去:

  1. (function fairyDustCursor() {
  2. var possibleColors = ["#D61C59", "#E7D84B", "#1B8798"]
  3. var width = window.innerWidth;
  4. var height = window.innerHeight;
  5. var cursor = {x: width/2, y: width/2};
  6. var particles = [];
  7. function init() {
  8. bindEvents();
  9. loop();
  10. }
  11. // Bind events that are needed
  12. function bindEvents() {
  13. document.addEventListener('mousemove', onMouseMove);
  14. document.addEventListener('touchmove', onTouchMove);
  15. document.addEventListener('touchstart', onTouchMove);
  16. window.addEventListener('resize', onWindowResize);
  17. }
  18. function onWindowResize(e) {
  19. width = window.innerWidth;
  20. height = window.innerHeight;
  21. }
  22. function onTouchMove(e) {
  23. if( e.touches.length > 0 ) {
  24. for( var i = 0; i < e.touches.length; i++ ) {
  25. addParticle( e.touches[i].clientX, e.touches[i].clientY, possibleColors[Math.floor(Math.random()*possibleColors.length)]);
  26. }
  27. }
  28. }
  29. function onMouseMove(e) {
  30. cursor.x = e.clientX;
  31. cursor.y = e.clientY;
  32. addParticle( cursor.x, cursor.y, possibleColors[Math.floor(Math.random()*possibleColors.length)]);
  33. }
  34. function addParticle(x, y, color) {
  35. var particle = new Particle();
  36. particle.init(x, y, color);
  37. particles.push(particle);
  38. }
  39. function updateParticles() {
  40. for( var i = 0; i < particles.length; i++ ) {
  41. particles[i].update();
  42. }
  43. for( var i = particles.length -1; i >= 0; i-- ) {
  44. if( particles[i].lifeSpan < 0 ) {
  45. particles[i].die();
  46. particles.splice(i, 1);
  47. }
  48. }
  49. }
  50. function loop() {
  51. requestAnimationFrame(loop);
  52. updateParticles();
  53. }
  54. function Particle() {
  55. this.character = "*";
  56. this.lifeSpan = 120; //ms
  57. this.initialStyles ={
  58. "position": "fixed",
  59. "top": "0", //必须加
  60. "display": "block",
  61. "pointerEvents": "none",
  62. "z-index": "10000000",
  63. "fontSize": "20px",
  64. "will-change": "transform"
  65. };
  66. this.init = function(x, y, color) {
  67. this.velocity = {
  68. x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2),
  69. y: 1
  70. };
  71. this.position = {x: x - 10, y: y - 20};
  72. this.initialStyles.color = color;
  73. console.log(color);
  74. this.element = document.createElement('span');
  75. this.element.innerHTML = this.character;
  76. applyProperties(this.element, this.initialStyles);
  77. this.update();
  78. document.body.appendChild(this.element);
  79. };
  80. this.update = function() {
  81. this.position.x += this.velocity.x;
  82. this.position.y += this.velocity.y;
  83. this.lifeSpan--;
  84. this.element.style.transform = "translate3d(" + this.position.x + "px," + this.position.y + "px,0) scale(" + (this.lifeSpan / 120) + ")";
  85. }
  86. this.die = function() {
  87. this.element.parentNode.removeChild(this.element);
  88. }
  89. }
  90. function applyProperties( target, properties ) {
  91. for( var key in properties ) {
  92. target.style[ key ] = properties[ key ];
  93. }
  94. }
  95. init();
  96. })();

接着,在\source\_databutterfly.yml引入:

  1. bottom:
  2. - <script type="text/javascript" src="/js/fairyDustCursor.js"></script>

忽略以下图片,可以自行尝试。

3.打字特效

\source\_databutterfly.yml修改:

4.页面特效

静态彩带

\source\_databutterfly.yml修改:

  1. # canvas_ribbon (靜止彩帶背景)
  2. # See: https://github.com/hustcc/ribbon.js
  3. canvas_ribbon:
  4. enable: false
  5. size: 150
  6. alpha: 0.6
  7. zIndex: -1
  8. click_to_change: true
  9. mobile: true

点击页面,彩带会进行变化

动态彩带

\source\_databutterfly.yml修改:

  1. # Fluttering Ribbon (動態彩帶)
  2. canvas_fluttering_ribbon:
  3. enable: true
  4. mobile: true

这个彩带可以动态变换

canvas_nest

\source\_databutterfly.yml修改:

  1. # canvas_nest
  2. # https://github.com/hustcc/canvas-nest.js
  3. canvas_nest:
  4. enable: false
  5. color: '0,0,255' #线条颜色, default: '0,0,0';
  6. opacity: 0.7 # 线条的不透明度 (0~1), default: 0.5.
  7. zIndex: -1 # z-index property of the background, default: -1.
  8. count: 99 # 线条数量, default: 99.
  9. mobile: false

这个可以鼠标自动吸附

Snackbar 弹窗

\source\_databutterfly.yml修改:

  1. # Snackbar (Toast Notification 彈窗)
  2. # position 彈窗位置
  3. # 可選 top-left / top-center / top-right / bottom-left / bottom-center / bottom-right
  4. snackbar:
  5. enable: true
  6. position: top-right
  7. bg_light: '#49b1f5' # light 背景下的样式
  8. bg_dark: '#121212' # dark 背景下的样式

开启后,在你设置的位置会有可爱的小弹窗出现。

大家可以尝试一下,按个人爱好开启。

底部设置

butterfly.yml中配置:

  1. # Footer Settings
  2. # --------------------------------------
  3. footer:
  4. owner:
  5. enable: true
  6. since: 2020
  7. custom_text: 11111
  8. copyright: true # false: Hexo那句不显示
  9. ICP: # Chinese ICP License #最后一句
  10. enable: true
  11. url: http://www.beian.gov.cn
  12. text: ICP20001029
  13. icon: /img/icp.png

修改主题文件美化

添加404页面

1.找到自己心仪的404页面,这个网站很多很多呦。

https://404.life/

2.在\source中创建一个404文件夹和一个404.html

3.修改404.html内容

红线的地方,可以自行选择是否修改

红框的地方,必须修改 (可以按照图片中修改)


4.设置404跳过渲染,在主目录_config.yml中:

  1. skip_render:
  2. - 404.html

5.butterfly.yml 可以关掉默认的404页面

  1. # A simple 404 page
  2. error_404:
  3. enable: false # 关闭
  4. subtitle: 'Page Not Found'
  5. background: https://i.loli.net/2020/05/19/aKOcLiyPl2JQdFD.png

修改滚动条

1.创建一个css文件移动到\themes\butterfly\source\css目录下。

2.引入方式

将以下代码复制到你所创建的css文件,引入即可。

  1. /* 滚动条 */
  2. ::-webkit-scrollbar {
  3. width: 8px;
  4. height: 8px;
  5. }
  6. ::-webkit-scrollbar-track {
  7. background-color: rgba(73, 177, 245, 0.2);
  8. border-radius: 2em;
  9. }
  10. ::-webkit-scrollbar-thumb {
  11. background-color: #49b1f5;
  12. background-image: -webkit-linear-gradient(
  13. 45deg,
  14. rgba(255, 255, 255, 0.4) 25%,
  15. transparent 25%,
  16. transparent 50%,
  17. rgba(255, 255, 255, 0.4) 50%,
  18. rgba(255, 255, 255, 0.4) 75%,
  19. transparent 75%,
  20. transparent
  21. );
  22. border-radius: 2em;
  23. }
  24. ::-webkit-scrollbar-corner {
  25. background-color: transparent;
  26. }
  27. ::-moz-selection {
  28. color: #fff;
  29. background-color: #49b1f5;
  30. }

页脚渐变

将以下代码复制到你所创建的css文件,引入即可。

可参考:修改滚动条部分中的引入方式

  1. /* 页脚footer */
  2. /* 渐变色滚动动画 */
  3. @-webkit-keyframes Gradient {
  4. 0% {
  5. background-position: 0 50%;
  6. }
  7. 50% {
  8. background-position: 100% 50%;
  9. }
  10. 100% {
  11. background-position: 0 50%;
  12. }
  13. }
  14. @-moz-keyframes Gradient {
  15. 0% {
  16. background-position: 0 50%;
  17. }
  18. 50% {
  19. background-position: 100% 50%;
  20. }
  21. 100% {
  22. background-position: 0 50%;
  23. }
  24. }
  25. @keyframes Gradient {
  26. 0% {
  27. background-position: 0 50%;
  28. }
  29. 50% {
  30. background-position: 100% 50%;
  31. }
  32. 100% {
  33. background-position: 0 50%;
  34. }
  35. }
  36. #footer {
  37. background: linear-gradient(-45deg, #ee7752, #ce3e75, #23a6d5, #23d5ab);
  38. background-size: 400% 400%;
  39. -webkit-animation: Gradient 10s ease infinite;
  40. -moz-animation: Gradient 10s ease infinite;
  41. animation: Gradient 10s ease infinite;
  42. -o-user-select: none;
  43. -ms-user-select: none;
  44. -webkit-user-select: none;
  45. -moz-user-select: none;
  46. user-select: none;
  47. border-top-left-radius: 10px;
  48. border-top-right-radius: 10px;
  49. }
  50. #footer:before {
  51. background-color: rgba(0, 0, 0, 0);
  52. }

更换背景及透明度

1.透明度

将以下代码复制到你所创建的css文件,引入即可。

可参考:修改滚动条部分中的引入方式

  1. /* 文章页背景 */
  2. .layout_post>#post {
  3. /* 以下代表白色透明度为0.3 */
  4. background: rgba(255,255,255,.3);
  5. }
  6. /* 所有背景(包括首页卡片、文章页、页面页等) */
  7. #aside_content .card-widget, #recent-posts>.recent-post-item, .layout_page>div:first-child:not(.recent-posts), .layout_post>#page, .layout_post>#post, .read-mode .layout_post>#post{
  8. /* 以下代表白色透明度为0.3 */
  9. background: rgba(255,255,255,.3);
  10. }

2.更换背景

老规矩,复制到你所创建的css文件,引入即可。

  1. #web_bg {
  2. background-image: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%);
  3. }

当然这是我的博客背景

如果你想更改,具体可以参考本博客文章:Hexo之更换背景及透明度

移动端优化

\themes\butterfly\source\css\_third-party\normalize.min.css添加如下css代码:

  1. /*移动端优化:去除归档、标签、最新文章、公告、、只保留网站统计*/
  2. @media screen and (max-width: 800px) {
  3. #aside_content
  4. div:not(:last-child) {
  5. display: none;
  6. font-size: 13px;
  7. }
  8. }

查看网页RSS

本次修改基于Butterfly主题 3.0.0 !

实现:增加社交图标RSS,点击可查看网页RSS。

1.下载插件hexo-generator-feed

  1. npm install hexo-generator-feed --save

2.在hexo的主配置文件_config.yml中任意位置添加以下代码:

  1. feed:
  2. type: atom
  3. path: atom.xml
  4. limit: 20
  5. hub:
  6. content:
  7. content_limit: 140
  8. content_limit_delim: ' '
  9. order_by: -date
  10. icon: icon.png
  11. autodiscovery: true
  12. template:

3.修改butterfly主题配置文件_config.yml ,添加RSS的图标:

  1. social:
  2. fa fa-rss: /atom.xml || RSS链接

社交信息设置

\source\_data中的butterfly.yml修改social

(可以选择使用fa fa-xxx图标,也可以选择使用阿里iconfont图标)

具体可参考:本站文章--Hexo-使用阿里iconfont图标


此处要注意:

​ 很多人不知道自己上方填的网址怎么找

RSS上面有教程,GiuhubGithubCSDNbilibili直接个人主页网址就可以

QQ:下方 xxxxxxx 填上对应的qq号码即可

  1. tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=xxxxxxx&website=www.oicqzone.com

标签外挂

1.Note语法

​ 移植于next主题:可以在\source\_data中的butterfly.yml修改:

  1. note:
  2. # Note tag style values:
  3. # - simple bs-callout old alert style. Default.
  4. # - modern bs-callout new (v2-v3) alert style.
  5. # - flat flat callout style with background, like on Mozilla or
  6. style: flat
  7. icons: true #是否开启图片
  8. border_radius: 3
  9. # Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
  10. # Offset also applied to label tag variables. This option can work with disabled note tag.
  11. light_bg_offset: 0

​ 该标签有两种使用方法。

默认模板

  1. {% note [class] [no-icon] [style] %}
  2. Any content (support inline tags too.io).
  3. {% endnote %}
名称 用法
class 【可选】标识,不同的标识有不同的配色
( default / primary / success / info / warning / danger )
no-icon 【可选】不显示 icon
style 【可选】可以覆盖配置中的 style
(simple/modern/flat/disabled)

一、simple

  1. {% note simple %}
  2. 默认 提示块
  3. {% endnote %}
  4. {% note default simple %}
  5. default 提示块
  6. {% endnote %}
  7. {% note primary simple %}
  8. primary 提示块
  9. {% endnote %}
  10. {% note success simple %}
  11. success 提示块
  12. {% endnote %}
  13. {% note info simple %}
  14. info 提示块
  15. {% endnote %}
  16. {% note warning simple %}
  17. warning 提示块
  18. {% endnote %}
  19. {% note danger simple %}
  20. danger 提示块
  21. {% endnote %}

更多可以在我的个人博客观看

2.图片放置

可以根据图片长度自行排列

  1. {% gallery %}
  2. markdown 图片格式
  3. {% endgallery %}

例如

  1. {% gallery %}
  2. ![](https://upimage.alexhchu.com/2020/10/21/f5ac68ddaaf64.jpg)
  3. ![](https://upimage.alexhchu.com/2020/10/21/0d1b78c7157d4.jpg)
  4. ![](https://upimage.alexhchu.com/2020/10/19/34446d0d37dde.jpg)
  5. {% endgallery %}

因为这个功能是用在Hexo美化中,在此博客效果不显示,具体可移步我的博客(最下方链接)

3.tag-hide

这个可以提供一个按钮,点击它,显示你隐藏的文字图片等。

Inline

这个可以隐藏文字,仅限于此。( content不能包含英文逗號,可用&sbquo;)

  1. {% hideInline content,display,bg,color %}
  • content: 文本內容

  • display: 按钮显示的文字(可选)

  • bg: 按钮的背景颜色(可选)

  • color: 按钮文字的颜色(可选)

Demo

  1. 座右铭座右铭!! {% hideInline 何其荣幸 何德何能,别点我,#FF7242,#fff %}
  2. 平平无奇。。。 {% hideInline 上面太花里胡哨了,上面真秀 %}

Block

这个也是提供一个按钮,而他可以隐藏文字图片代码块等。( dispaly不能包含英文逗號,可用&sbquo;)

  1. {% hideBlock display,bg,color %}
  2. content
  3. {% endhideBlock %}
  • content: 文本內容

  • display: 按钮显示的文字(可选)

  • bg: 按钮的背景颜色(可选)

  • color: 按钮文字的颜色(可选)

Demo

  1. 座右铭座右铭!!
  2. {% hideBlock 别点我,#FF7242,#fff %}
  3. 何其荣幸 何德何能
  4. {% endhideBlock %}
  5. 平平无奇。。。
  6. {% hideBlock 上面真秀 %}
  7. 上面太花里胡哨了
  8. {% endhideBlock %}

Toggle

如果你需要展示的內容太多,可以把它隐藏在收缩框里,需要时再把它展开

  1. {% hideToggle display,bg,color %}
  2. content
  3. {% endhideToggle %}

Demo

  1. {% hideToggle Wecome to my Blog %}
  2. 欢迎欢迎欢迎
  3. MoYus Blog
  4. Giteehttps://moyu-zc.gitee.io/
  5. Githubhttps://moyu-zc.github.io/
  6. {% endhideToggle %}

因为这个功能是用在Hexo美化中,在此博客效果不显示,具体可移步我的博客(最下方链接)

4.mermaid

mermaid标签不允许嵌套于一些隐藏属性的标签外挂

例如: tag-hide內的标签外挂和tabs标签外挂,也不能压缩代码

这会导致mermaid图示无法正常显示,使用时请留意。

使用mermaid标签可以绘制Flowchart(流程图)Sequence diagram(时序图 )Class Diagram(类别图)State Diagram(状态图)Gantt(甘特图)Pie Chart(圆形图),具体可以查看mermaid文檔

\source\_data中的butterfly.yml中修改:

  1. mermaid:
  2. enable: true
  3. # built-in themes: default/forest/dark/neutral
  4. theme: default

写法

  1. {% mermaid %}
  2. 內容
  3. {% endmermaid %}

Demo

  1. {% mermaid %}
  2. pie
  3. Test X
  4. "A" : 50
  5. "B" : 20
  6. "C" : 10
  7. "D" : 5
  8. {% endmermaid %}

因为这个功能是用在Hexo美化中,在此博客效果不显示,具体可移步我的博客(最下方链接)

5.Tabs

Demo1------默认方式

  1. {% tabs test1 %}
  2. <!-- tab -->
  3. **This is Tab 1.**
  4. <!-- endtab -->
  5. <!-- tab -->
  6. **This is Tab 2.**
  7. <!-- endtab -->
  8. <!-- tab -->
  9. **This is Tab 3.**
  10. <!-- endtab -->
  11. {% endtabs %}

Demo2------预设选择``tabs`

  1. {% tabs test2, 3 %}
  2. <!-- tab -->
  3. **This is Tab 1.**
  4. <!-- endtab -->
  5. <!-- tab -->
  6. **This is Tab 2.**
  7. <!-- endtab -->
  8. <!-- tab -->
  9. **This is Tab 3.**
  10. <!-- endtab -->
  11. {% endtabs %}

Demo3------没有预设

  1. {% tabs test3, -1 %}
  2. <!-- tab -->
  3. **This is Tab 1.**
  4. <!-- endtab -->
  5. <!-- tab -->
  6. **This is Tab 2.**
  7. <!-- endtab -->
  8. <!-- tab -->
  9. **This is Tab 3.**
  10. <!-- endtab -->
  11. {% endtabs %}

Demo4------自定义Tab名、 只有icon、icon和Tab名

  1. {% tabs test4 %}
  2. <!-- tab 第一個Tab -->
  3. **tab名字为第一个Tab**
  4. <!-- endtab -->
  5. <!-- tab @fab fa-bell -->
  6. **只有图标 没有Tab名字**
  7. <!-- endtab -->
  8. <!-- tab 身份证@fas fa-address-card -->
  9. **名字+icon**
  10. <!-- endtab -->
  11. {% endtabs %}

因为这个功能是用在Hexo美化中,在此博客效果不显示,具体可移步我的博客(最下方链接)

6.Button

模板

  1. {% btn [url],[text],[icon],[color] [style] [layout] [position] [size] %}
  2. [url] : 链接
  3. [text] : 按钮文字
  4. [icon] : [可选] 图标
  5. [color] : [可选] 按钮背景颜色(默认style时)
  6. 按鈕字體和邊框顔色(outline時)
  7. default/blue/pink/red/purple/orange/green
  8. [style] : [可选] 按钮样式 默认实心
  9. outline/留空
  10. [layout] : [可选] 按钮布局 默认为line
  11. block/留空
  12. [position] : [可选] 按钮位置 前提是设置了layoutblock 默认为左边
  13. center/right/留空
  14. [size] : [可选] 按钮大小
  15. larger/留空
  1. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block %}
  2. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block center larger %}
  3. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block right outline larger %}

More styles:

  1. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,larger %}
  2. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,blue larger %}
  3. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,pink larger %}
  4. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,red larger %}
  5. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,outline purple larger %}
  6. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,outline orange larger %}
  7. {% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,outline green larger %}

因为这个功能是用在Hexo美化中,在此博客效果不显示,具体可移步我的博客(最下方链接)

分享功能

分享功能有两种:

第一种:

如果你不知道 sharejs,可以查看说明

主目录下/source/_data--butterfly.yml中修改:

  1. sharejs:
  2. enable: true
  3. sites: facebook,twitter,wechat,weibo,qq #想要显示的內容

第二种:

如果你不知道addtoany,可以查看说明

主目录下/source/_data--butterfly.yml中修改:

  1. addtoany:
  2. enable: true
  3. item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link

在线聊天

通用设置

butterfly中,有几种内置的在线聊天工具。

简单的,打开chat_btn,在右下角开启小按钮。

  1. # Chat Button [recommend]
  2. # It will create a button in the bottom right corner of website, and hide the origin button
  3. chat_btn: true

为了不影响访客体验,可以开启chat_hide_show,开启后,只有向上滚动才会显示聊天按钮向下滚动时会隐藏按钮

  1. # The origin chat button is displayed when scrolling up, and the button is hidden when scrolling down
  2. chat_hide_show: true

如果使用工具自带的聊天按钮,位置可能会遮挡右下角图标,可以配置``rightside-bottom`调整右下角图标位置

chatra

chatra注册账号.

可以在Preferences中找到Public key

之后/source/_data--butterfly.yml中修改:

  1. # chatra
  2. # https://chatra.io/
  3. chatra:
  4. enable: true
  5. id: #这个就是Public key

tidio

tidio注册账号。

可以在Preferences中找到Public key

设置中还可以设置样式

之后/source/_data--butterfly.yml中修改:

  1. # tidio
  2. # https://www.tidio.com/
  3. tidio:
  4. enable: true
  5. public_key: #这个就是Public key

daovoice

daovoice中注册。

应用设置----安装到网站 之中的app id

可在聊天设置里可以配置聊天按钮等样式

之后/source/_data--butterfly.yml中修改:

  1. # daovoice
  2. # http://daovoice.io/
  3. daovoice:
  4. enable: true
  5. app_id: #这个就是app id

gitter

gitter中登录上账号。

创建一個community或者room,复制名称到设置去。

  1. # gitter
  2. # https://gitter.im/
  3. gitter:
  4. enable: true
  5. room: MoYuzc/community #名称放这儿


crisp

打开crisp,注册账号。

在设置中,找到网站ID

之后,在butterflt.yml中修改:

  1. # crisp
  2. # https://crisp.chat/en/
  3. crisp:
  4. enable: true
  5. website_id: #网站ID填写这儿

评论功能

开启评论需要在butterfly.yml---comments---use中填写你需要的评论。

支持双评论显示,只需要配置两个评论(第一个为默认显示)

  1. comments:
  2. use:
  3. - Valine
  4. # - Disqus
  5. text: true
  6. lazyload: false
  7. count: false
参数 解释
use 使用的评论(填写的评论首字母需要大写。最多支持两个,不需要就留空)
text 是否显示评论服务商的名字
lazyload 是否为评论开启lazyload,开启后,只有滚动到评论位置时才会加载评论所需要的资源(开启lazyload后,评论数将不显示)
count 是否在文章顶部显示评论数
livere 和 utterances 不支持评论数显示

注意:双评论不能是 Disqus Disqusjs 一起,由于其共用同一个 ID,会出错。

以下是举例的我在用的:Valine

1.在LeanCloud中注册账号,并进入。

2.创建应用,命名就随便啦

3.创建成功后,进入设置

4.进入应用Keys

应用Keys中有AppIDAppKey,这两个需要填写到你的butterfly.yml

5.填写butterfly.yml

  1. # valine
  2. # https://valine.js.org
  3. valine:
  4. appId: # app id
  5. appKey: # app key
  6. pageSize: 10
  7. avatar: monsterid
  8. lang: zh-CN
  9. placeholder: Please leave your footprints p
  10. guest_info: nick,mail,link
  11. recordIP: true
  12. serverURLs:
  13. bg:
  14. emojiCDN:
  15. enableQQ: true
  16. requiredFields: nick,mail

​ 持续更新ing~~

个人博客为:

MoYu's Github Blog

MoYu's Gitee Blog

Butterfly美化的更多相关文章

  1. Hexo博客美化之蝴蝶(butterfly)主题魔改

      Hexo是轻量级的极客博客,因为它简便,轻巧,扩展性强,搭建部署方便深受广大人们的喜爱.各种琳琅满路的Hexo主题也是被各种大佬开发出来,十分钦佩,向大佬仰望,大声称赞:流批!!! 我在翻看各种主 ...

  2. Hexo+Butterfly主题美化

    前言 本博客基于Hexo框架搭建,用到 hexo-theme-butterfly 主题(本人博客Butterfly版本3.4.0),hexo-theme-butterfly是基于Molunerfinn ...

  3. Linux 桌面美化那点事儿

    各个 Linux 桌面发行版刚拿到手的时候,或多或少都有点儿不满意,对它们进行一些改造是必须的.网上不乏各种 Linux 桌面美化的教程和经验贴,对我们这些 Linux 爱好者来说都是很好的参考资料. ...

  4. Django admin美化插件suit应用[原创]

    前言 由于比较懒,自己弄了一个用户验证,没有自己写后台,用了django自带的user认证,并通过admin直接进行管理,但默认的admin并不漂亮,于是使用了这个django-suit插件,效果对比 ...

  5. 网站美化常见CSS

    伴随网络时代日新月异的发展,用户不仅仅满足于软件系统的功能需求,对软件系统的页面显示效果以及交互模式的要求也逐渐提高.尤其是展示性质的平台页面对于界面美化效果要求更高,有一句话说的好:Html是结构, ...

  6. console 输出信息美化

    不久前在一些前端的网站上看到的效果,以前觉得console只是拿来做做调试,不过现在看到别人网站的console美化效果,这个还可以作为一种网站个性来显示的.. 以%c开头,后面的文字就打印的信息,后 ...

  7. Jquery制作--美化下拉框

    平常我们用的原生select下拉框,大部分样式没办法修改,导致在不同的浏览器里面会跟设计图的风格大相径庭.所以为了能让它美化起来,就用JQ模拟了一个下拉框,可以随意定义样式.原生的下拉框也保留在div ...

  8. KRPano资源分析工具使用说明(KRPano XML/JS解密 切片图批量下载 球面图还原 加密混淆JS还原美化)

    软件交流群:571171251(软件免费版本在群内提供) krpano技术交流群:551278936(软件免费版本在群内提供) 最新博客地址:blog.turenlong.com 限时下载地址:htt ...

  9. select样式美化(简单实用)

    美化select,可以实用一个a标签将select嵌套进去,然后将<a>相对定位,在将select绝对定位,美化<a>即可 文件下载链接:https://i.cnblogs.c ...

随机推荐

  1. ftp设置二进制上传

    一个不重要的数据库,备份是用expdp导出,然后上传到ftp服务器上面.上周这个主机宕机了,要在别的数据库恢复,发现报如下错误: ORA-39001: invalid argument value O ...

  2. EXPORT和IMPORT使用示例

    1 report ztestprog. 2 data:begin of itab1 occurs 0, 3 ff(10), 4 end of itab1. 5 data:itab2 like itab ...

  3. HTML基础复习3

    CSS 可以理解为对HTML的一种补充 CSS由两部分组成:选择器.声明,声明中包含属性和值 CSS中的选择器 HTML标签选择器 类选择器 在标签上使用class属性为标签起个类名,在CSS中使用. ...

  4. JDK的各个版本

    Java的各个版本 从上图我们看出,Java的版本名最开始以JDK开头,后来以j2se开头,最后到现在以Java开头,所以这些名字我们都可以说,但人们说的更多的是JDK多少,或者Java多少

  5. 全网最详细的PyCharm+Anaconda的安装。

    目录 PyCharm的安装 一.下载安装包 1.安装网站 2.在导航栏输入网址回车 3.点击 DOWNLOAD. 4.它有专业版和社区版,我们下载社区版就可以使用了.(专业版要收费) 二.安装过程 5 ...

  6. Python爬虫:数据分析小能手:JSON库的用法

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,易于人阅读和编写. 给大家推荐一个Python交流的q裙,大家在学习遇到了什么问题都可以进群一起交流,大家 ...

  7. 【分享】每个 Web 开发者在 2021 年必须拥有 15 个 VSCode 扩展

    为什么VSCode如此受欢迎 Visual Studio Code在开发人员中迅速流行起来,它是最流行的开发环境,可定制性是其流行的原因之一. 因此,如果你正在使用VSCode,这里有一个扩展列表,你 ...

  8. 为失败设计,大量引入对SRE的理解,鲁棒性高

    https://go-kratos.dev/#/ Principles 简单:不过度设计,代码平实简单 通用:通用业务开发所需要的基础库的功能 高效:提高业务迭代的效率 稳定:基础库可测试性高,覆盖率 ...

  9. Okio Okio源码分析

    概述 Okio 作为 Okhttp 底层 io 库,它补充了 java.io 和 java.nio 的不足,使访问.存储和处理数据更加容易.Okio 的特点如下: okio 是一个由 square 公 ...

  10. Spring框架——IOC&DI

    Spring Spring 目标 内容 Spring与web整合的原理 Spring 中包含的关键特性 Spring架构图 企业级框架 企业级系统 IOCDI IOC DI IOC和DI 为什么使用依 ...