ButterFly主题美化
Table of Contents
我这里只总结了自己用到的,可以看原教程:hexo主题butterfly配置
主题安装
在项目的根目录 Blog 右键打开终端,输入如下指令安装
| |
安装 pug 和 stylus 渲染器
| |
修改占点配置文件,开启主题
| |
为了減少升级主题带来的不便,可以把主题文件夹中的 _config.yml 重命名为 _config.butterfly.yml,复制到根目录下与站点配置文件同级。
Hexo 会自动合并主题中的 _config.yml 和 _config.butterfly.yml ,如果存在同名配置,会使用 _config.butterfly.yml 的配置,其优先度较高。所以像和博客网址相关联的固定资料可以设置在 _config.yml 中,比如博客的标题、作者信息和邮箱等等资料,而和主题样式相关的配置放在 _config.butterfly.yml 中,那么在将来你想换一个主题是很方便的。
设置博客个人资料
修改站点配置文件,可以修改网站的各种基本资料
| |
导航栏菜单
修改主题配置文件,如下
| |
代码块显示设置
根据如下修改主题配置文件
| |
同时将站点配置文件的 highlight 的 enable 设置为 false
| |
本地搜索功能
安装搜索插件
1npm install hexo-generator-search --save在主题配置文件中查找修改
1 2 3 4 5local_search: enable: true labels: input_placeholder: Search for Posts hits_empty: "We didn't find any results for the search: ${query}" # 如果没有查到内容相关内容显示
创建文件夹
创建对应的文件夹,需要保证创建的文件夹名称与导航栏菜单里的 / / 中的内容一致才能打开对应的栏目。在根目录下右键打开终端输入指令
| |
这个 name 就是你要创建的文件夹名称,例如
| |
指令输入之后会在 /source/ 文件夹下会生成你所创建的文件夹,并且其中都包含着一个 index.md 文件,并且做如下修改, title 是对应的文件夹下的 index.md 文件做的修改
| |
修改副标题
在主题配置文件中,查找并修改
| |
图片设置
网站图标
1favicon: /img/favicon.png头像
1 2 3avatar: img: /img/avatar.jpg #图片路径 effect: false #头像会一直转圈网站背景图
1 2 3 4# Website Background (設置網站背景) # can set it to color or image (可設置圖片 或者 顔色) # The formal of image: url(http://xxxxxx.com/xxx.jpg) background: url(/img/background.jpg)主页头部图
1index_img: /img/index_img.jpg文章详情页图
1 2# If the banner of page not setting, it will show the top_img default_top_img: /img/top_img.jpg归档页顶部图
1 2# The banner image of archive page archive_img: /img/archive_img.jpgtag 标签页顶部图
1 2 3# If the banner of tag page not setting, it will show the top_img # note: tag page, not tags page (子標籤頁面的 top_img) tag_img: /img/tag_img.jpgcategories 分类页顶部图
1 2 3# If the banner of category page not setting, it will show the top_img # note: category page, not categories page (子分類頁面的 top_img) category_img: /img/category_img.jpg统一文章封面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16cover: # 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 # When cover is not set, the default cover is displayed (當沒有設置cover時,默認的封面顯示) default_cover: - https: - http: - http: - http: - http: - http:为每一篇文章设置不同的封面,可以在文章自己的 markdown 文件中添加配置
1 2 3 4 5 6 7 8--- title: Hello World tags: [hello] categories: summary: hello word~ top_img: /img/hello-1.png # 顶部背景图 cover: /img/hello-1.png # 文章封面 ---
图片大图查看
修改主题配置文件
| |
版权样式
修改主题配置文件
复制内容增加版权信息
1 2 3 4 5 6# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息) copy: enable: true copyright: enable: false limit_count: 50文章版权信息
1 2 3 4 5 6post_copyright: enable: true decode: true author_href: https://seashore.top license: CC BY-NC-SA 4.0 license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
相关文章
在文章最下面出现推送信息
| |
侧边栏样式
修改主题配置文件
| |
个人信息
修改主题配置文件
| |
公告栏
修改主题配置文件
| |
TOC目录
修改主题配置文件
| |
背景特效美化
修改主题配置文件
鼠标点击效果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37# Typewriter Effect (打字效果) # https://github.com/disjukr/activate-power-mode activate_power_mode: enable: false colorful: true # open particle animation (冒光特效) shake: true # open shake (抖动特效) mobile: false # Mouse click effects: fireworks (鼠标点击效果:萤火特效) fireworks: enable: false zIndex: 9999 # -1 or 9999 mobile: false # Mouse click effects: Heart symbol (鼠标点击效果: 爱心) click_heart: enable: false mobile: false # Mouse click effects: words (鼠标点击效果: 文字) ClickShowText: enable: false text: - 富强 - 民主 - 文明 - 和谐 - 平等 - 公正 - 法治 - 爱国 - 敬业 - 诚信 - 友善 fontSize: 15px random: true mobile: true打字效果
1 2 3 4 5 6 7# Typewriter Effect (打字效果) # https://github.com/disjukr/activate-power-mode activate_power_mode: enable: false colorful: true # open particle animation (冒光特效) shake: true # open shake (抖动特效) mobile: true背景特效
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24# Background effects (背景特效) # canvas_ribbon (静止彩带) # See: https://github.com/hustcc/ribbon.js canvas_ribbon: enable: false size: 150 alpha: 0.6 zIndex: -1 click_to_change: false mobile: false # Fluttering Ribbon (动态彩带) canvas_fluttering_ribbon: enable: false mobile: false #星空特效 # canvas_nest # https://github.com/hustcc/canvas-nest.js canvas_nest: enable: true color: '0,0,255' #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.) opacity: 0.7 # the opacity of line (0~1), default: 0.5. zIndex: -1 # z-index property of the background, default: -1. count: 99 # the number of lines, default: 99. mobile: falsefooter 背景
1footer_bg: true # 设置为 false 将于主题色一致,设置为 true 与 top_img 一致
字数统计
安装字数统计插件
1npm install hexo-wordcount --save修改主题配置文件
1 2 3 4 5 6# wordcount (字數統計) wordcount: enable: true post_wordcount: true min2read: true total_wordcount: true
分享
修改主题配置文件,在 addThis , sharejs , addtoany 中选择一个开启就可以
| |