Front-matter Front-matter 是 markdown 文件最上方以 --- 分隔的區域,用於指定個別檔案的變數。
Page Front-matter 用於 頁面 配置
Post Front-matter 用於 文章頁 配置
如果標注 可選的參數,可根據自己需要添加,不用全部都寫在 markdown 裏
Page Front-matter 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 title: date: updated: tags: categories: keywords: description: top_img: comments: cover: toc: toc_ style_simple: copyright: copyright_ author:copyright_url: copyright_ info:mathjax: katex: aplayer: highlight_shrink: aside: abcjs: noticeOutdate:
參數
解釋
title
【必需】頁面標題
date
【必需】頁面創建日期
type
【必需】標籤、分類和友情鏈接三個頁面需要配置
updated
【可選】頁面更新日期
description
【可選】頁面描述
keywords
【可選】頁面關鍵字
comments
【可選】顯示頁面評論模塊 (默認 true)
top_img
【可選】頁面頂部圖片
mathjax
【可選】顯示 mathjax (當設置 mathjax 的 per_page: false 時,才需要配置,默認 false)
katex
【可選】顯示 katex (當設置 katex 的 per_page: false 時,才需要配置,默認 false)
aside
【可選】顯示側邊欄 (默認 true)
aplayer
【可選】在需要的頁面加載 aplayer 的 js 和 css,請參考文章下面的音樂 配置
highlight_shrink
【可選】配置代碼框是否展開 (true/false) (默認為設置中 highlight_shrink 的配置)
random
【可選】配置友情鏈接是否隨機排序(默認為 false)
limit
【可選】配置説説顯示數量
Post Front-matter 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 --- title: date: updated: tags: categories: keywords: description: top_img: comments: cover: toc: toc_ number:toc_style_ simple: copyright: copyright_author: copyright_ author_href: copyright_ url:copyright_info: mathjax: katex: aplayer: highlight_ shrink:aside: abcjs: noticeOutdate: ---
寫法
解释
title
【必需】文章標題
date
【必需】文章創建日期
updated
【可選】文章更新日期
tags
【可選】文章標籤
categories
【可選】文章分類
keywords
【可選】文章關鍵字
description
【必填】文章描述
top_img
【必填】文章頂部圖片或縮略圖(如果有設定 top_img 將會展示縮略圖)
cover
comments
【必填】【选填] 显示评论模块(默认true)
toc_number
toc_style_simple
copyright
copyright_author
文章作者头像
文章链接
文章内容摘要
文章发布时间及版本说明
标签页 标签页文件名不一定是 tags, 例子中的 tags 只是一个示例记得添加 type: "tags"
进入你的 Hexo 的根目录。
输入 hexo new page tags.
你会看到 source/tags/index.md 这个文件。
修改这个文件:
1 2 3 4 5 6 7 8 --- title: 标签页 date: 2018-01-05 00:00:00 type: 'tags' orderby: random order: 1 ---
分类页 分类页文件名不一定是 categories, 例子中的 categories 只是一个示例记得添加 type: "categories"。
进入你的 Hexo 的根目录。
输入 hexo new page categories.
你会看到 source/categories/index.md 这个文件。
修改这个文件:
1 2 3 4 5 6 --- title: 分类页 date: 2018-01-05 00:00:00 type: 'categories' ---
友情链接 为你的博客创建一个友情链接!
创建友情链接页面 友情链接页面文件名不一定是 link, 例子中的 link 只是一个示例记得添加 type: "link"
进入你的 Hexo 的根目录。
输入 hexo new page link.
你会看到 source/link/index.md 这个文件。
修改这个文件:
1 2 3 4 5 6 --- title: 友情链接页 date: 2018-06-07 22:17:49 type: 'link' ---
数据来源 在 Hexo 根目录下的 _data(如果没有 _data 文件夹,请自行创建),创建一个文件 link.yml(如果没有 _data 文件夹,请自行创建),请参考下面的内容。
自定义本地生成数据源 在 Hexo 根目录下的 _data(如果没有 _data 文件夹,请自行创建),创建一个文件 link.yml(如果没有 _data 文件夹,请自行创建),请参考下面的内容。
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 - class_name: 友情链接 class_desc:那些人,那些事 link_list: - name : Hexo link : https://hexo.io/zh-tw/ avatar : https://d33wubrfki0l68.cloudfront.net/6657ba50e702d84afb32fe846bed54fba1a77add/827ae/logo.svg descr : 快速、簡單且強大的網誌框架 - name : 網站 link : https://www.youtube.com/ avatar : https://i.loli.net/2020/05/14/9ZkGg8v3azHJfM1.png descr : 视頻網站 - name : Weibo link : https://www.weibo.com/ avatar : https://i.loli.net/2020/05/14/TLJBum386vcnI1P.png descr : 中國最大社交分享平台 - name : Twitter link : https://twitter.com/ avatar : https://i.loli.net/2020/05/14/5VyHPQqR6LWF39a.png descr : 社交分享平台
使用远程拉取的数据源 从 V5.0 开始,支持从远程加载友情链接,远程拉取只支持 json。
注意:选择远程加载后,本地生成的方法会无效。
在 source/link/index.md 这个文件的 front-matter 添加远程链接
Json 的格式如下:
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 38 [ { class_name: "友好链接" , class_desc:"那些人,那些事" , link_list: [ { name : "Hexo" , link : "https://hexo.io/" , avatar : "https://d33wubrfki0l68.cloudfront.net/" , descr : "快速、簡單且強大的網誌框架" } ] } , { class_name: "网站" , class_desc:"值得推荐的网站" , link_list: [ { name : "Youtube" , link : "https://www.youtube.com/" , avatar : "https://i.loli.net/" , descr : "视频网站" } , { name : "Weibo" , link : "https://www.weibo.com/" , avatar : "https://i.loli.net/" , descr : "中国最大社交分享平台" } , { name : "Twitter" , link : "https://twitter.com/" , avatar : "https://i.loli.net/" , descr : "社交媒体分享平台" } ] } ]
友情链接随机排序 主题支持友情链接随机排序,只需要在顶部 front-matter 添加 random:true
友情链接界面设置 由 V5.2 开始,友情链接界面可以由用户自己定制,在友好的 Markdown 段落书写。
图库 图库页面只是普通的页面,你只需要 hexo n page xxxxx 創建你的页面就行。
然后使用标签外挂 galleryGroup ,具体的用法请查看对应的文档。
1 2 3 4 5 6 7 8 <div class="gallery-group-main"> { {% galleryGroup '壁纸' '收藏的一些壁纸' '/Gallery/wallpaper' % } {% galleryGroup '漫画' '关于漫画的照片' '/Gallery/manga' % } {% galleryGroup 'Oh My Girl' '关于Oh My Girl的照片' '/Gallery/OHG' % } </div>
壁纸 收藏的一些壁纸点击查看详情
漫威 关于漫威的照片点击查看详情
OH MY GIRL 关于OH MY GIRL的照片点击查看详情
子页面 子页面也是普通的页面,你只需要 hexo n page xxxxx 創建你的页面就行。
然后使用标签外挂 gallery ,具体的用法请查看对应的文档。
1 2 3 4 5 6 7 8 9 10 11 { /galleryList>        }
如果你想要使用 /photo/OHG 如何显示图片内容,则可以把新建好的 OHMG 整个文件夹移到 photo 文件夹里去。
回顾历史记录与升级指南 如果你想要回滚到旧版本,请执行以下命令:
1 2 3 git checkout master themes/butterfly-docs-old-version.zip themes/butterfly-docs-new-version.zip git merge master themes/butterfly-docs-new-version.zip git push origin master themes/butterfly-docs-new-version.zip
如果你想要升级到新版本,请执行以下命令:
1 2 3 git checkout master themes/butterfly-docs-old-version.zip themes/butterfly-docs-new-version.zip git merge master themes/butterfly-docs-new-version.zip git push origin master themes/butterfly-docs-new-version.zip
软件安装与运行环境要求
安装 Git:下载并解压仓库进行安装。
安装 npm:通过 npm 安装软件包。
如果在中国大陆访问 GitHub 不稳定时,请考虑使用 Gitee 平台进行安装稳定版【建议】
其他注意事项与提示
避免将个人所需文件放到主题 source 文件夹内;否则在升级过程中可能会覆盖删除这些文件。
在 Hexo 根目录下创建一个新的文件夹来存放个人所需的资源和图片。引用文件应为该文件夹下的路径,并确保正确引入相关 CSS 和 JS 文件。
对于第三方插件如 hexo-tag-aplayer ,必须将其放入主题 root 目录下的 _config 下才能正常工作。若想启用此插件,请参阅其官方文档并将其作为 JavaScript 和 CSS 引入即可。此外,在主题 root 目录下执行以下命令以自动导入 JSON 和 CSS 文件:
1 2 3 4 5 npm install hexo-renderer-pug hexo-renderer-stylus --save-or-yarn or yarn add hexo-renderer-pug hexo-renderer-stylus ./themes/butterfly/doc/_config.json assets/themes/butterfly/doc/assets/css/theme.css assets/themes/butterfly/doc/assets/js/theme.min.js assets/themes/butterfly/doc/assets/lib/jquery.min.js assets/themes/butterfly/doc/assets/lib/stylus.min.js assets/themes/butterfly/doc/assets/lib/stylus.parse.min.js assets/themes/butterfly/doc/assets/lib/font-awesome.min.css assets/themes/butterfly/doc/assets/lib/bootstrap.min.css assets/themes/butterfly/doc/assets/lib/highlight.min.css assets/themes/butterfly/doc/assets/lib/applayer.min.css assets/themes/butterfly/doc/assets/lib/applayer.min.js assets/themes/butterfly/doc/assets/css/custom.css assets/themes/butterfly/doc/assets/js/custom.js assets/themes/butterfly/doc/assets/lib/jquery-ui.min.js assets/themes/butterfly/doc/assets/lib/jquery.ui.autocomplete.min.js assets/themes/butterfly/doc/assets/lib/jquery.cookie.min.js assets/themes/butterfly/doc/assets/lib/jquery.validate.min.js assets/themes/butterfly/doc/assets/lib/lodash.min.js ./themes/butterfly/config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json config.json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config-json.config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_json_config_jsonconfig-json-config-json-config-json-config-json-config-json-config-json-config-json-config Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.Json.JSConfigJSConfigJSConfigJSConfigJSConfigJSConfigJSConfigJSConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.ConfigJSON.