Front-matter

Front-matter 是 markdown 文件最上方以 — 分隔的区域,用于指定个别档案的变数。

Page Front-matter 用于页面配置

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的配置)

这个地方是\scaffolds文件夹下面的POST模板

title: {{ title }}
date: {{ date }}
updated:
categories:
tags:
keywords:
description:
top:
sticky:
permalink:
comments: 是否显示评论(除非设置false,可以不写)
top_img:
cover:
photos:
toc: 是否显示toc (除非特定文章设置,可以不写)
toc_number: 是否显示toc数字 (除非特定文章设置,可以不写)
toc_max_depth:
copyright: 是否显示版权 (除非特定文章设置,可以不写)
link:
sitemap: false

Post Front-matter 用于文章页配置

title	【必需】文章标题
date 【必需】文章创建日期
updated 【可选】文章更新日期
tags 【可选】文章标籤
categories 【可选】文章分类
keywords 【可选】文章关键字
description 【可选】文章描述
top_img 【可选】文章顶部图片
cover 【可选】文章缩略图(如果没有设置top_img,文章页顶部将显示缩略图,可设为false/图片地址/留空)
comments 【可选】显示文章评论模块(默认 true)
toc 【可选】显示文章TOC(默认为设置中toc的enable配置)
toc_number 【可选】显示toc_number(默认为设置中toc的number配置)
toc_style_simple 【可选】显示 toc 简洁模式
copyright 【可选】显示文章版权模块(默认为设置中post_copyright的enable配置)
mathjax 【可选】显示mathjax(当设置mathjax的per_page: false时,才需要配置,默认 false)
katex 【可选】显示katex(当设置katex的per_page: false时,才需要配置,默认 false)
aplayer 【可选】在需要的页面加载aplayer的js和css,请参考文章下面的音乐 配置
highlight_shrink 【可选】配置代码框是否展开(true/false)(默认为设置中highlight_shrink的配置)
aside 【可选】显示侧边栏 (默认 true)
top: 置顶
sticky: 1 你可以直接在文章的front-matter区域里添加属性来把这篇文章置顶。数值越大,置顶的优先级越大。
toc_max_depth: 最大几级目录
link: 标题的链接
photos:
sitemap: false 添加到帖子/页面的前言。sitemap: false

注意:

故障排除 | Hexo

  • 请确认您使用空格进行缩进(Soft tab),并确认冒号后有加上一个空格。比如:top:

一些说明

文章页 的 top_img

请到对应的 md 页面,设置front-matter中的top_img

属性值:

  • 留空

  • true - 可选择颜色:

    • HEX值 - #0000FF

    • RGB值 - rgb(0,0,255)

    • 顔色单词 - orange

    • 渐变色 - linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)

      ​ linear-gradient(20deg, #0062be, #925696, #cc426e, #fb0347)

  • false - 显示默认的顔色

  • transparent - 透明

  • img链接:相对或者绝对路径

文章封面

文章的markdown文档上,在Front-matter添加cover,并填上要显示的图片地址。如果不配置cover,可以设置显示默认的cover.(已经设置了很多张随机了~~)

如果有文章(例如:转载文章)不需要显示版权,可以在文章Front-matter单独设置copyright: false

TOC

在文章页,会有一个目录,用于显示TOC。可以为特定的文章配置,在你的文章md文件的头部,加入toc_number和toc,并配置true或者false即可。主题会优先判断文章Markdown的Front-matter是否有配置,如有,则以Front-matter的配置为准。否则,以主题配置文件中的配置为准

收缩框

如果你需要展示的内容太多,可以把它隐藏在收缩框里,需要时再把它展开。( display 不能包含英文逗号,可用‚)

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

比如:
{% hideToggle Butterfly安装方法 %}
在你的博客根目录里
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
如果想要安装比较新的dev分支,可以
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
{% endhideToggle %}

可折叠选项

<details>
<summary>支持的漏洞列表 [点击展开] </summary>
====>>>>这个地方包裹需要展开和收缩的列表
<details>

Tabs使用方法

{% tabs Unique name, [index] %}
<!-- tab [Tab caption] [@icon] -->
Any content (support inline tags too).
<!-- endtab -->
{% endtabs %}

Unique name : Unique name of tabs block tag without comma.
Will be used in #id's as prefix for each tab with their index numbers.
If there are whitespaces in name, for generate #id all whitespaces will replaced by dashes.
Only for current url of post/page must be unique!
[index] : Index number of active tab.
If not specified, first tab (1) will be selected.
If index is -1, no tab will be selected. It's will be something like spoiler.
Optional parameter.
[Tab caption] : Caption of current tab.
If not caption specified, unique name with tab index suffix will be used as caption of tab.
If not caption specified, but specified icon, caption will empty.
Optional parameter.
[@icon] : FontAwesome icon name (full-name, look like 'fas fa-font')
Can be specified with or without space; e.g. 'Tab caption @icon' similar to 'Tab caption@icon'.
Optional parameter.

Demo 1 - 预设选择第一个【默认】

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

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

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

This is Tab 1.

This is Tab 2.

This is Tab 3.

评论数据管理

由于Valine 是无后端评论系统,所以也就没有开发评论数据管理功能。请自行登录Leancloud应用管理。

具体步骤:登录>选择你创建的应用>存储>选择Class Comment,然后就可以尽情的发挥你的权利啦(~ ̄▽ ̄)~

当然,你也可以配合 @DesertsP 开发的 Valine-Admin 进行评论数据管理

注意事项

在 Hexo 博客中,评论的功能在所有页面都默认开启,但是有的时候我们在页面上不需要显示评论功能,例如分类,标记页面我们并不需要评论功能。

在 Front-matter 中通过comments属性设置true或false控制该页面或者是文章的评论功能是否打开,如下:

title: Tags
date: 2019-12-19 16:10:19
type: "tags"
comments: false

hexo设置永久文内链接,自定义跳转到本站的其他博客:

{% post_link 文章文件名(不要后缀) 显示文字(可自定义,一般写文章标题) %}

refer: