主頁 > 企業開發 > Butterfly美化

Butterfly美化

2021-02-13 06:16:40 企業開發

Butterfly美化

首先提示,本文量特別大哦!基本上有所有的美化,還在持續更新ing,謹慎入坑.........

主題組態檔修改

基礎配置

最最最開始的,好不容易搭建了自己的個人博客,當然要寫上自己的名字、簽名......,證明身份,而且身為一個Chinese,還是中文舒服,所以主目錄下_config.yml的組態檔:

# Site
title: FATE      #標題名字
subtitle: ''
description: ''  #簽名
keywords:
author: MoYu-zc  #作者名字
language: zh-CN  #默認en  可以改為這個
timezone: ''

主題支持以下三種語言:

  • default(en)
  • zh-CN (簡體中文)
  • zh-TW (繁體中文)
1 2

導航欄修改

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

(如果沒有這個檔案夾,創建一個_data,把\themes\butterfly也就是主題檔案夾下的_config.yml移動到_data檔案夾下,重命名為butterfly.yml,以后只需要修改這個檔案,這樣為了留個備份,你搞壞了配置,還可以重新換成最開始的狀態) ↓: 名稱: /xxxx/ || 圖示

menu:
  首頁: / || fa fa-home
  歸檔: /archives/ || fa fa-archive
  標簽: /tags/ || fa fa-tags
  分類: /categories/ || fa fa-folder-open
  留言板: /messageboard/ || fa fa-paper-plane
  友鏈: /link/ || fa fa-link
  日志: /timeline/ || fa fa-bell
  選單 || fa fa-list:
    - 關于 || /about/ || fa fa-sitemap
    - myself || /myself/ || fa fa-id-card
    - butterfly主題 || https://github.com/jerryc127/hexo-theme-butterfly/ || fa fa-heart

3

代碼塊樣式

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

## 代碼塊樣式
highlight_theme: mac #default/darker/pale night/light/ocean/mac /false/  前面的引數任選一項為代碼塊顯示效果
highlight_copy: true # copy button  是否顯示復制按鈕
highlight_lang: true # show the code language 是否顯示代碼塊語言
highlight_shrink: false #true:打開文章默認折疊代碼塊內容/false:打開文章默認展開代碼塊/none:關閉代碼折疊按鈕
code_word_wrap: false  # 關閉滾動條

然后找到 Hexo 組態檔_config.yml,將line_number改成false:

highlight:
  enable: true
  line_number: false # 改為false
  auto_detect: false
  tab_replace:

4

本地搜索

# Local search 本地搜索
local_search:
  enable: true
  labels:
    input_placeholder: Search for Posts
    hits_empty: "We didn't find any results for the search: ${query}" # 如果沒有查到內容相關內容顯示

需要安裝插件,不然hexo g直接報錯:

npm install hexo-generator-search --save

5

分割線圖示更換

本次修改基于Butterfly主題 3.0.0 !

將圖示更換為“太空飛船”,

修改butterfly主題組態檔_data--_config.yml

hr_icon:
  enable: true
  icon: '\f197' # the unicode value of Font Awesome icon
  icon-top: -10px

icon-top常用數值:

-20px:圖示位于分割線上方

-10px:圖示位于分割線中間

0px:圖示位于分割線下方

6

創建標簽檔案夾

會在\source中創建對應的檔案夾index.md

1.歸檔

這個頁面不用創建,自動已經帶了

2.標簽

命令列輸入:

hexo new page tags

出現source/tags/index.md檔案:

---
title: 標簽
date: 2018-01-05 00:00:00
type: "tags"
---

以后上傳文章的md檔案中,可以在標題頭中加入tags,包含 標簽 文章的例子:

---
title: 標簽測驗
tags:
  - 1111                 (這個就是文章的標簽了)
  - 2222              (這個就是文章的標簽了)
---

3.分類

命令列輸入:

hexo new page categories

出現source/categories/index.md檔案:

---
title: 分類
date: 2018-01-05 00:00:00
type: "categories"
---

以后上傳文章的md檔案中,可以在標題頭中加入categories,包含 分類 文章的例子:

---
title: 分類測驗
categories:
  - 1111                   (這個就是文章的分類了)
  - 2222                   (這個就是文章的分類了)
---

4.留言板

命令列輸入:

hexo new page messageboard

出現source/messageboard/index.md檔案:

---
title: 留言板
date: 2018-01-05 00:00:00
type: "messageboard"
---

5.友鏈

5.1、創建友情鏈接頁面

命令列輸入:

hexo new page link

出現source/link/index.md檔案:

---
title: 友鏈
date: 2018-01-05 00:00:00
type: "link"
---
5.2、友情鏈接添加

在Hexo目錄中的source/_data,創建一個檔案link.yml,內容如下:

class:
  class_name: 友情鏈接
  link_list:
    1:
      name: 姓名
      link: 鏈接
      avatar: 圖片
      descr: 簽名
    2:
      name: 姓名
      link: 鏈接
      avatar: 圖片
      descr: 簽名

6.日志

命令列輸入:

hexo new page timeline

出現source/timeline/index.md檔案:

---
title: 日志
date: 2018-01-05 00:00:00
type: "timeline"
---

7.關于

命令列輸入:

hexo new page about

出現source/about/index.md檔案:

---
title: 關于
date: 2018-01-05 00:00:00
type: "about"
---

8.myself

命令列輸入:

hexo new page myself

出現source/myself/index.md檔案:

---
title: This is me
date: 2018-01-05 00:00:00
type: "myself"
---

標題樣式

1.副標題設定

如果沒設定副標題,上面的description:簽名,就是顯示在主頁面,而設定的話,簽名自動不顯示,副標題出現,

\source\_data中的butterfly.yml:

subtitle:
  enable: true

 sub:
    - 何其榮幸 何德何能
    - 所有的不平凡都來自平凡

這個他們可以設定以下,打字效果可以開啟,個人感覺不錯,但是需要注意:

 # 如果有英文逗號' , ',請使用轉義字元 ,
 # 如果有英文雙引號' " ',請使用轉義字元 "
 # 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住
 # 如果關閉打字效果,subtitle只會顯示sub的第一行文字

我嘗試了轉義字符,但是會到“,”時,可能會有點卡,可以用空格代替,

7

2.副標題字體大小顏色

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

#site-subtitle
    color: var(--white)   此處修改為白色
    font-size: 1.05em     字體大小

    +minWidth768()
      font-size: 1.40em   字體大小

圖片設定

圖片可以使用網上的圖片(即使用該圖片鏈接),也可以使用\themes\butterfly\source\img下的圖片,

1.網站圖示

# Favicon(網站圖示)
favicon: /img/favicon.png

2.頭像

# Avatar (頭像)
avatar:
  img: /img/tit.png
  effect: false

3.主頁面圖片

# The banner image of home page (主頁的橫幅影像)
index_img: /img/index_img.jpg

4.子標簽頁圖片

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

5.推薦

  1. 主頁的頂部圖可以在butterfly.yml設定index_img
  2. ``archives頁的頂部圖可以在Butterfly.yml設定archive_img`
  3. 其他page頁的頂部圖可以在各自的md頁面設定front-matter中的top_img
favicon: /img/favicon.png
avatar:
  img: /img/tit.png
  effect: false
index_img: /img/index_img.jpg
default_top_img: /img/tag.jpg #這個推薦:不加入可能部分標簽頁不出現圖片
archive_img: /img/tag.jpg
tag_img: /img/tag.jpg
category_img: /img/tag.jpg
8 9

6.文章串列圖片

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

cover:
  # display the cover or not (是否顯示文章封面)
  index_enable: true
  aside_enable: true
  archives_enable: true
  # the position of cover in home page (封面顯示的位置)
  # left/right/both
  position: both
  default_cover:

文章封面設定:

一個:

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

多個:

此時會隨機選擇一張,

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

or文章內

10

7.圖片查看大圖

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

這是兩種方式只能選擇一個 或者 兩個都不選

11

8.圖片懶加載

1.新增hexo-lazyload-image模塊

npm install hexo-lazyload-image --save

2.在主目錄組態檔_config.yml增加配置

lazyload:
  enable: true
  loadingImg: /img/loading.gif

這個就是圖片沒加載出來的時候,出現一個動圖轉轉轉,

文章頁樣式

1.復制的內容后面加上著作權資訊

# copy settings
# copyright: Add the copyright information after copied content (復制的內容后面加上著作權資訊)
copy:
  enable: true

(↑這個相信大家都見過,不演示了)

2.文章著作權資訊

在底部會出現對應的作者、鏈接、宣告

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

post_copyright:
  enable: true
  decode: true
  license: CC BY-NC-SA 4.0
  license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
12

3.TOC目錄

在文章頁,會有一個目錄,用于顯示TOC,

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

# toc (目錄)
toc:
  enable: true
  number: true
  auto_open: true # auto open the sidebar
13

4.相關文章

在文章最下面,會出現相關資訊文章的推送,

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

# Related Articles
related_post:
  enable: true
  limit: 6 # Number of posts displayed  顯示的文章數
  date_type: created # or created or updated 文章日期顯示創建榷訓者更新日

5.打賞

在你每篇文章的結尾,可以添加打賞按鈕,對應二維碼可以自行配置,

沒有提供二維碼的,可配置icon圖片,然后在link上添加相應的打賞鏈接,用戶點擊圖片就會跳轉到對應鏈接去,

link可以不寫,會默認為圖片的鏈接,

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

# Sponsor/reward
reward:
  enable: false
  QR_code:
     - img: /img/wechat.jpg
       link:
       text: wechat
     - img: /img/alipay.jpg
       link:
       text: alipay
14

側邊框樣式

1.側邊框出現位置

\source\_databutterfly.yml修改:

# aside (側邊欄)
# --------------------------------------
aside:
  enable: true
  mobile: true # display on mobile
  position: left # left or right 

left:側邊框出現在左側

right::側邊框出現在右側

15

2.Follow me資訊修改

\source\_databutterfly.yml修改:

16

圖中icon圖示使用的阿里iconfont圖示

具體可參考:本站文章--Hexo-使用阿里iconfont圖示

3.公告

\source\_databutterfly.yml修改:

card_announcement:
    enable: true
    content: This is my Blog  #修改此處

17

4.訪問人數和運行時間

# 訪問人數
busuanzi:
  site_uv: true
  site_pv: true
  page_pv: true
  
  # 網頁運行時間
runtimeshow:
  enable: true
  publish_date: 10/11/2020 00:00:00
  #格式: 月/日/年 時間
  #也可以 年/月/日 時間

18

19

20

特效部分

1.滑鼠點擊特效

\source\_databutterfly.yml修改:

21

2.滑鼠移動特效

\themes\butterfly\source\css中創建一個css檔案,將以下代碼復制進去:

(function fairyDustCursor() {

  var possibleColors = ["#D61C59", "#E7D84B", "#1B8798"]
  var width = window.innerWidth;
  var height = window.innerHeight;
  var cursor = {x: width/2, y: width/2};
  var particles = [];

  function init() {
    bindEvents();
    loop();
  }

  // Bind events that are needed
  function bindEvents() {
    document.addEventListener('mousemove', onm ouseMove);
    document.addEventListener('touchmove', onTouchMove);
    document.addEventListener('touchstart', onTouchMove);

    window.addEventListener('resize', onWindowResize);
  }

  function onWindowResize(e) {
    width = window.innerWidth;
    height = window.innerHeight;
  }

  function onTouchMove(e) {
    if( e.touches.length > 0 ) {
      for( var i = 0; i < e.touches.length; i++ ) {
        addParticle( e.touches[i].clientX, e.touches[i].clientY, possibleColors[Math.floor(Math.random()*possibleColors.length)]);
      }
    }
  }

  function onm ouseMove(e) {
    cursor.x = e.clientX;
    cursor.y = e.clientY;

    addParticle( cursor.x, cursor.y, possibleColors[Math.floor(Math.random()*possibleColors.length)]);
  }

  function addParticle(x, y, color) {
    var particle = new Particle();
    particle.init(x, y, color);
    particles.push(particle);
  }

  function updateParticles() {

    for( var i = 0; i < particles.length; i++ ) {
      particles[i].update();
    }

    for( var i = particles.length -1; i >= 0; i-- ) {
      if( particles[i].lifeSpan < 0 ) {
        particles[i].die();
        particles.splice(i, 1);
      }
    }

  }

  function loop() {
    requestAnimationFrame(loop);
    updateParticles();
  }

  function Particle() {

    this.character = "*";
    this.lifeSpan = 120; //ms
    this.initialStyles ={
      "position": "fixed",
      "top": "0", //必須加
      "display": "block",
      "pointerEvents": "none",
      "z-index": "10000000",
      "fontSize": "20px",
      "will-change": "transform"
    };

    this.init = function(x, y, color) {

      this.velocity = {
        x:  (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2),
        y: 1
      };

      this.position = {x: x - 10, y: y - 20};
      this.initialStyles.color = color;
      console.log(color);

      this.element = document.createElement('span');
      this.element.innerHTML = this.character;
      applyProperties(this.element, this.initialStyles);
      this.update();

      document.body.appendChild(this.element);
    };

    this.update = function() {
      this.position.x += this.velocity.x;
      this.position.y += this.velocity.y;
      this.lifeSpan--;

      this.element.style.transform = "translate3d(" + this.position.x + "px," + this.position.y + "px,0) scale(" + (this.lifeSpan / 120) + ")";
    }

    this.die = function() {
      this.element.parentNode.removeChild(this.element);
    }

  }

  function applyProperties( target, properties ) {
    for( var key in properties ) {
      target.style[ key ] = properties[ key ];
    }
  }

  init();
})();

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

  bottom:
     - <script type="text/javascript" src="https://www.cnblogs.com/js/fairyDustCursor.js"></script>

22

忽略以下圖片,可以自行嘗試,

23

3.打字特效

\source\_databutterfly.yml修改:

24

4.頁面特效

靜態彩帶

\source\_databutterfly.yml修改:

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

點擊頁面,彩帶會進行變化

動態彩帶

\source\_databutterfly.yml修改:

# Fluttering Ribbon (動態彩帶)
canvas_fluttering_ribbon:
  enable: true
  mobile: true

這個彩帶可以動態變換

canvas_nest

\source\_databutterfly.yml修改:

# canvas_nest
# https://github.com/hustcc/canvas-nest.js
canvas_nest:
  enable: false
  color: '0,0,255' #線條顏色, default: '0,0,0'; 
  opacity: 0.7 # 線條的不透明度 (0~1), default: 0.5.
  zIndex: -1 # z-index property of the background, default: -1.
  count: 99 # 線條數量, default: 99.
  mobile: false

這個可以滑鼠自動吸附

Snackbar 彈窗

\source\_databutterfly.yml修改:

# Snackbar (Toast Notification 彈窗)
# position 彈窗位置
# 可選 top-left / top-center / top-right / bottom-left / bottom-center / bottom-right
snackbar:
  enable: true
  position: top-right
  bg_light: '#49b1f5' # light 背景下的樣式
  bg_dark: '#121212' # dark 背景下的樣式

開啟后,在你設定的位置會有可愛的小彈窗出現,

大家可以嘗試一下,按個人愛好開啟,

25

底部設定

butterfly.yml中配置:

# Footer Settings
# --------------------------------------
footer:
  owner:
    enable: true
    since: 2020
  custom_text: 11111
  copyright: true # false: Hexo那句不顯示
  ICP: # Chinese ICP License   #最后一句
    enable: true
    url: http://www.beian.gov.cn
    text: 豫ICP備20001029號
    icon: /img/icp.png

26

修改主題檔案美化

添加404頁面

1.找到自己心儀的404頁面,這個網站很多很多呦,

https://404.life/

2.在\source中創建一個404檔案夾和一個404.html

27

3.修改404.html內容

? 紅線的地方,可以自行選擇是否修改

? 紅框的地方,必須修改 (可以按照圖片中修改)

28 29

4.設定404跳過渲染,在主目錄_config.yml中:

skip_render:
  - 404.html

5.butterfly.yml 可以關掉默認的404頁面

# A simple 404 page
error_404:
  enable: false  # 關閉
  subtitle: 'Page Not Found'
  background: https://i.loli.net/2020/05/19/aKOcLiyPl2JQdFD.png
30

修改滾動條

1.創建一個css檔案移動到\themes\butterfly\source\css目錄下,

31

2.引入方式

32

將以下代碼復制到你所創建的css檔案,引入即可,

/* 滾動條 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
 
::-webkit-scrollbar-track {
  background-color: rgba(73, 177, 245, 0.2);
  border-radius: 2em;
}
 
::-webkit-scrollbar-thumb {
  background-color: #49b1f5;
  background-image: -webkit-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.4) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0.4) 75%,
    transparent 75%,
    transparent
  );
  border-radius: 2em;
}
 
::-webkit-scrollbar-corner {
  background-color: transparent;
}
 
::-moz-selection {
  color: #fff;
  background-color: #49b1f5;
}

頁腳漸變

將以下代碼復制到你所創建的css檔案,引入即可,

可參考:修改滾動條部分中的引入方式

/* 頁腳footer */
/* 漸變色滾動影片 */
@-webkit-keyframes Gradient {
    0% {
        background-position: 0 50%;
    }
 
    50% {
        background-position: 100% 50%;
    }
 
    100% {
        background-position: 0 50%;
    }
}
 
@-moz-keyframes Gradient {
    0% {
        background-position: 0 50%;
    }
 
    50% {
        background-position: 100% 50%;
    }
 
    100% {
        background-position: 0 50%;
    }
}
 
@keyframes Gradient {
    0% {
        background-position: 0 50%;
    }
 
    50% {
        background-position: 100% 50%;
    }
 
    100% {
        background-position: 0 50%;
    }
}
#footer {
    background: linear-gradient(-45deg, #ee7752, #ce3e75, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    -webkit-animation: Gradient 10s ease infinite;
    -moz-animation: Gradient 10s ease infinite;
    animation: Gradient 10s ease infinite;
    -o-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
#footer:before {
    background-color: rgba(0, 0, 0, 0);
}

更換背景及透明度

1.透明度

將以下代碼復制到你所創建的css檔案,引入即可,

可參考:修改滾動條部分中的引入方式

/* 文章頁背景 */
.layout_post>#post {
    /* 以下代表白色透明度為0.3 */
    background: rgba(255,255,255,.3);
}

/* 所有背景(包括首頁卡片、文章頁、頁面頁等) */
#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{
    /* 以下代表白色透明度為0.3 */
    background: rgba(255,255,255,.3);
}

2.更換背景

老規矩,復制到你所創建的css檔案,引入即可,

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

當然這是我的博客背景

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

移動端優化

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

/*移動端優化:去除歸檔、標簽、最新文章、公告、、只保留網站統計*/
@media screen and (max-width: 800px) {
    #aside_content
    div:not(:last-child) {
        display: none;
        font-size: 13px;
    }
}

查看網頁RSS

本次修改基于Butterfly主題 3.0.0 !

實作:增加社交圖示RSS,點擊可查看網頁RSS,

1.下載插件hexo-generator-feed

npm install hexo-generator-feed --save

2.在hexo的主組態檔_config.yml中任意位置添加以下代碼:

feed:
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '
  order_by: -date
  icon: icon.png
  autodiscovery: true
  template:

3.修改butterfly主題組態檔_config.yml ,添加RSS的圖示:

social:
  fa fa-rss: /atom.xml || RSS鏈接

社交資訊設定

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

(可以選擇使用fa fa-xxx圖示,也可以選擇使用阿里iconfont圖示)

具體可參考:本站文章--Hexo-使用阿里iconfont圖示

33 34

此處要注意:

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

? RSS上面有教程,GiuhubGithubCSDNbilibili直接個人主頁網址就可以

? QQ:下方 xxxxxxx 填上對應的qq號碼即可

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

標簽外掛

1.Note語法

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

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

? 該標簽有兩種使用方法,

? 默認模板

{% note [class] [no-icon] [style] %}
Any content (support inline tags too.io).
{% endnote %}
名稱
用法
class 【可選】標識,不同的標識有不同的配色
( default / primary / success / info / warning / danger )
no-icon 【可選】不顯示 icon
style 【可選】可以覆寫配置中的 style
(simple/modern/flat/disabled)

一、simple

{% note simple %}
默認 提示塊
{% endnote %}

{% note default simple %}
default 提示塊
{% endnote %}

{% note primary simple %}
primary 提示塊
{% endnote %}

{% note success simple %}
success 提示塊
{% endnote %}

{% note info simple %}
info 提示塊
{% endnote %}

{% note warning simple %}
warning 提示塊
{% endnote %}

{% note danger simple %}
danger 提示塊
{% endnote %}

更多可以在我的個人博客觀看

2.圖片放置

可以根據圖片長度自行排列

{% gallery %}
markdown 圖片格式
{% endgallery %}

例如

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

因為這個功能是用在Hexo美化中,在此博客效果不顯示,具體可移步我的博客(最下方鏈接)

3.tag-hide

這個可以提供一個按鈕,點擊它,顯示你隱藏的文字圖片等,

Inline

這個可以隱藏文字,僅限于此,( content不能包含英文逗號,可用&sbquo;)

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

  • display: 按鈕顯示的文字(可選)

  • bg: 按鈕的背景顏色(可選)

  • color: 按鈕文字的顏色(可選)

Demo

座右銘座右銘!! {% hideInline 何其榮幸 何德何能,別點我,#FF7242,#fff %}

平平無奇,,,  {% hideInline 上面太花里胡哨了,上面真秀 %}

Block
這個也是提供一個按鈕,而他可以隱藏文字圖片代碼塊等,( dispaly不能包含英文逗號,可用&sbquo;)

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

  • display: 按鈕顯示的文字(可選)

  • bg: 按鈕的背景顏色(可選)

  • color: 按鈕文字的顏色(可選)

Demo

座右銘座右銘!! 
{% hideBlock  別點我,#FF7242,#fff %}
何其榮幸 何德何能
{% endhideBlock %}
平平無奇,,,  
{% hideBlock 上面真秀 %}
 上面太花里胡哨了
{% endhideBlock %}

Toggle
如果你需要展示的內容太多,可以把它隱藏在收縮框里,需要時再把它展開

{% hideToggle display,bg,color %}
content
{% endhideToggle %}

Demo

{% hideToggle Wecome to my Blog %}
 歡迎歡迎歡迎
 MoYu‘s Blog
 Gitee:https://moyu-zc.gitee.io/
 Github:https://moyu-zc.github.io/
{% 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中修改:

mermaid:
  enable: true
  # built-in themes: default/forest/dark/neutral
  theme: default

寫法

{% mermaid %}
內容
{% endmermaid %}

Demo

{% mermaid %}
pie
   Test X
    "A" : 50
    "B" : 20
    "C" : 10
    "D" :  5
{% endmermaid %}

因為這個功能是用在Hexo美化中,在此博客效果不顯示,具體可移步我的博客(最下方鏈接)

5.Tabs

Demo1------默認方式

{% tabs test1 %}
<!-- tab -->
**This is Tab 1.**
<!-- endtab -->

<!-- tab -->
**This is Tab 2.**
<!-- endtab -->

<!-- tab -->
**This is Tab 3.**
<!-- endtab -->
{% endtabs %}

Demo2------預設選擇``tabs`

{% tabs test2, 3 %}
<!-- tab -->
**This is Tab 1.**
<!-- endtab -->

<!-- tab -->
**This is Tab 2.**
<!-- endtab -->

<!-- tab -->
**This is Tab 3.**
<!-- endtab -->
{% endtabs %}

Demo3------沒有預設

{% tabs test3, -1 %}
<!-- tab -->
**This is Tab 1.**
<!-- endtab -->

<!-- tab -->
**This is Tab 2.**
<!-- endtab -->

<!-- tab -->
**This is Tab 3.**
<!-- endtab -->
{% endtabs %}

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

{% tabs test4 %}
<!-- tab 第一個Tab -->
**tab名字為第一個Tab**
<!-- endtab -->

<!-- tab @fab fa-bell -->
**只有圖示 沒有Tab名字**
<!-- endtab -->

<!-- tab 身份證@fas fa-address-card -->
**名字+icon**
<!-- endtab -->
{% endtabs %}

因為這個功能是用在Hexo美化中,在此博客效果不顯示,具體可移步我的博客(最下方鏈接)

6.Button

模板

{% btn [url],[text],[icon],[color] [style] [layout] [position] [size] %}

[url]         : 鏈接
[text]        : 按鈕文字
[icon]        : [可選] 圖示
[color]       : [可選] 按鈕背景顏色(默認style時)
                      按鈕字體和邊框顔色(outline時)
                      default/blue/pink/red/purple/orange/green
[style]       : [可選] 按鈕樣式 默認實心
                      outline/留空
[layout]      : [可選] 按鈕布局 默認為line
                      block/留空
[position]    : [可選] 按鈕位置 前提是設定了layout為block 默認為左邊
                      center/right/留空
[size]        : [可選] 按鈕大小
                      larger/留空
{% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block %}
{% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block center larger %}
{% btn 'https://moyu-zc.gitee.io/',MoYu,far fa-hand-point-right,block right outline larger %}

More styles:

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

因為這個功能是用在Hexo美化中,在此博客效果不顯示,具體可移步我的博客(最下方鏈接)

分享功能

分享功能有兩種:

第一種:

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

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

sharejs:
  enable: true
  sites: facebook,twitter,wechat,weibo,qq  #想要顯示的內容

35

第二種:

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

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

addtoany:
  enable: true
  item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link
36

在線聊天

通用設定

butterfly中,有幾種內置的在線聊天工具,

簡單的,打開chat_btn,在右下角開啟小按鈕,

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

為了不影響訪客體驗,可以開啟chat_hide_show,開啟后,只有向上滾動才會顯示聊天按鈕向下滾動時會隱藏按鈕

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

如果使用工具自帶的聊天按鈕,位置可能會遮擋右下角圖示,可以配置``rightside-bottom`調整右下角圖示位置

chatra
在chatra中注冊賬號.

可以在Preferences中找到Public key

38

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

# chatra
# https://chatra.io/
chatra:
  enable: true
  id:           #這個就是Public key

tidio

在tidio中注冊賬號,

可以在Preferences中找到Public key

設定中還可以設定樣式

39

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

# tidio
# https://www.tidio.com/
tidio:
  enable: true
  public_key:    #這個就是Public key
40

daovoice

daovoice中注冊,

應用設定----安裝到網站 之中的app id

可在聊天設定里可以配置聊天按鈕等樣式

41

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

# daovoice
# http://daovoice.io/
daovoice:
  enable: true 
  app_id:      #這個就是app id
42

gitter

在gitter中登錄上賬號,

創建一個community或者room,復制名稱到設定去,

# gitter
# https://gitter.im/
gitter:
  enable: true
  room: MoYuzc/community   #名稱放這兒
43 44

crisp

打開crisp,注冊賬號,

在設定中,找到網站ID

45

之后,在butterflt.yml中修改:

# crisp
# https://crisp.chat/en/
crisp:
  enable: true
  website_id:    #網站ID填寫這兒
46

評論功能

開啟評論需要在butterfly.yml---comments---use中填寫你需要的評論,

支持雙評論顯示,只需要配置兩個評論(第一個為默認顯示)

comments:
  use:
   - Valine
  # - Disqus    
  text: true 
  lazyload: false
  count: false 
引數 解釋
use 使用的評論(填寫的評論首字母需要大寫,最多支持兩個,不需要就留空)
text 是否顯示評論服務商的名字
lazyload 是否為評論開啟lazyload,開啟后,只有滾動到評論位置時才會加載評論所需要的資源(開啟lazyload后,評論數將不顯示)
count 是否在文章頂部顯示評論數
livere 和 utterances 不支持評論數顯示

注意:雙評論不能是 Disqus Disqusjs 一起,由于其共用同一個 ID,會出錯,

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

1.在LeanCloud中注冊賬號,并進入,

47

2.創建應用,命名就隨便啦

48

3.創建成功后,進入設定

49

4.進入應用Keys

應用Keys中有AppIDAppKey,這兩個需要填寫到你的butterfly.yml

50

5.填寫butterfly.yml

# valine
# https://valine.js.org
valine:
  appId:              #  app id
  appKey:              # app key
  pageSize: 10
  avatar: monsterid 
  lang: zh-CN 
  placeholder: Please leave your footprints p
  guest_info: nick,mail,link 
  recordIP: true 
  serverURLs: 
  bg: 
  emojiCDN: 
  enableQQ: true 
  requiredFields: nick,mail
52

? 持續更新ing~~

個人博客為:
MoYu's Github Blog
MoYu's Gitee Blog

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/259124.html

標籤:其他

上一篇:Butterfly美化

下一篇:請教關于生產報警信號與監控攝像頭的聯動問題

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • IEEE1588PTP在數字化變電站時鐘同步方面的應用

    IEEE1588ptp在數字化變電站時鐘同步方面的應用 京準電子科技官微——ahjzsz 一、電力系統時間同步基本概況 隨著對IEC 61850標準研究的不斷深入,國內外學者提出基于IEC61850通信標準體系建設數字化變電站的發展思路。數字化變電站與常規變電站的顯著區別在于程序層傳統的電流/電壓互 ......

    uj5u.com 2020-09-10 03:51:52 more
  • HTTP request smuggling CL.TE

    CL.TE 簡介 前端通過Content-Length處理請求,通過反向代理或者負載均衡將請求轉發到后端,后端Transfer-Encoding優先級較高,以TE處理請求造成安全問題。 檢測 發送如下資料包 POST / HTTP/1.1 Host: ac391f7e1e9af821806e890 ......

    uj5u.com 2020-09-10 03:52:11 more
  • 網路滲透資料大全單——漏洞庫篇

    網路滲透資料大全單——漏洞庫篇漏洞庫 NVD ——美國國家漏洞庫 →http://nvd.nist.gov/。 CERT ——美國國家應急回應中心 →https://www.us-cert.gov/ OSVDB ——開源漏洞庫 →http://osvdb.org Bugtraq ——賽門鐵克 →ht ......

    uj5u.com 2020-09-10 03:52:15 more
  • 京準講述NTP時鐘服務器應用及原理

    京準講述NTP時鐘服務器應用及原理京準講述NTP時鐘服務器應用及原理 安徽京準電子科技官微——ahjzsz 北斗授時原理 授時是指接識訓通過某種方式獲得本地時間與北斗標準時間的鐘差,然后調整本地時鐘使時差控制在一定的精度范圍內。 衛星導航系統通常由三部分組成:導航授時衛星、地面檢測校正維護系統和用戶 ......

    uj5u.com 2020-09-10 03:52:25 more
  • 利用北斗衛星系統設計NTP網路時間服務器

    利用北斗衛星系統設計NTP網路時間服務器 利用北斗衛星系統設計NTP網路時間服務器 安徽京準電子科技官微——ahjzsz 概述 NTP網路時間服務器是一款支持NTP和SNTP網路時間同步協議,高精度、大容量、高品質的高科技時鐘產品。 NTP網路時間服務器設備采用冗余架構設計,高精度時鐘直接來源于北斗 ......

    uj5u.com 2020-09-10 03:52:35 more
  • 詳細解讀電力系統各種對時方式

    詳細解讀電力系統各種對時方式 詳細解讀電力系統各種對時方式 安徽京準電子科技官微——ahjzsz,更多資料請添加VX 衛星同步時鐘是我京準公司開發研制的應用衛星授時時技術的標準時間顯示和發送的裝置,該裝置以M國全球定位系統(GLOBAL POSITIONING SYSTEM,縮寫為GPS)或者我國北 ......

    uj5u.com 2020-09-10 03:52:45 more
  • 如何保證外包團隊接入企業內網安全

    不管企業規模的大小,只要企業想省錢,那么企業的某些服務就一定會采用外包的形式,然而看似美好又經濟的策略,其實也有不好的一面。下面我通過安全的角度來聊聊使用外包團的安全隱患問題。 先看看什么服務會使用外包的,最常見的就是話務/客服這種需要大量重復性、無技術性的服務,或者是一些銷售外包、特殊的職能外包等 ......

    uj5u.com 2020-09-10 03:52:57 more
  • PHP漏洞之【整型數字型SQL注入】

    0x01 什么是SQL注入 SQL是一種注入攻擊,通過前端帶入后端資料庫進行惡意的SQL陳述句查詢。 0x02 SQL整型注入原理 SQL注入一般發生在動態網站URL地址里,當然也會發生在其它地發,如登錄框等等也會存在注入,只要是和資料庫打交道的地方都有可能存在。 如這里http://192.168. ......

    uj5u.com 2020-09-10 03:55:40 more
  • [GXYCTF2019]禁止套娃

    git泄露獲取原始碼 使用GET傳參,引數為exp 經過三層過濾執行 第一層過濾偽協議,第二層過濾帶引數的函式,第三層過濾一些函式 preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'] (?R)參考當前正則運算式,相當于匹配函式里的引數 因此傳遞 ......

    uj5u.com 2020-09-10 03:56:07 more
  • 等保2.0實施流程

    流程 結論 ......

    uj5u.com 2020-09-10 03:56:16 more
最新发布
  • 使用Django Rest framework搭建Blog

    在前面的Blog例子中我們使用的是GraphQL, 雖然GraphQL的使用處于上升趨勢,但是Rest API還是使用的更廣泛一些. 所以還是決定回到傳統的rest api framework上來, Django rest framework的官網上給了一個很好用的QuickStart, 我參考Qu ......

    uj5u.com 2023-04-20 08:17:54 more
  • 記錄-new Date() 我忍你很久了!

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 大家平時在開發的時候有沒被new Date()折磨過?就是它的諸多怪異的設定讓你每每用的時候,都可能不小心踩坑。造成程式意外出錯,卻一下子找不到問題出處,那叫一個煩透了…… 下面,我就列舉它的“四宗罪”及應用思考 可惡的四宗罪 1. Sa ......

    uj5u.com 2023-04-20 08:17:47 more
  • 使用Vue.js實作文字跑馬燈效果

    實作文字跑馬燈效果,首先用到 substring()截取 和 setInterval計時器 clearInterval()清除計時器 效果如下: 實作代碼如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta ......

    uj5u.com 2023-04-20 08:12:31 more
  • JavaScript 運算子

    JavaScript 運算子/運算子 在 JavaScript 中,有一些運算子可以使代碼更簡潔、易讀和高效。以下是一些常見的運算子: 1、可選鏈運算子(optional chaining operator) ?.是可選鏈運算子(optional chaining operator)。?. 可選鏈操 ......

    uj5u.com 2023-04-20 08:02:25 more
  • CSS—相對單位rem

    一、概述 rem是一個相對長度單位,它的單位長度取決于根標簽html的字體尺寸。rem即root em的意思,中文翻譯為根em。瀏覽器的文本尺寸一般默認為16px,即默認情況下: 1rem = 16px rem布局原理:根據CSS媒體查詢功能,更改根標簽的字體尺寸,實作rem單位隨螢屏尺寸的變化,如 ......

    uj5u.com 2023-04-20 08:02:21 more
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 08:01:50 more
  • 如何在 vue3 中使用 jsx/tsx?

    我們都知道,通常情況下我們使用 vue 大多都是用的 SFC(Signle File Component)單檔案組件模式,即一個組件就是一個檔案,但其實 Vue 也是支持使用 JSX 來撰寫組件的。這里不討論 SFC 和 JSX 的好壞,這個仁者見仁智者見智。本篇文章旨在帶領大家快速了解和使用 Vu ......

    uj5u.com 2023-04-20 08:01:37 more
  • 【Vue2.x原始碼系列06】計算屬性computed原理

    本章目標:計算屬性是如何實作的?計算屬性快取原理以及洋蔥模型的應用?在初始化Vue實體時,我們會給每個計算屬性都創建一個對應watcher,我們稱之為計算屬性watcher ......

    uj5u.com 2023-04-20 08:01:31 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:01:10 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:00:32 more