Hexo使用指南
Hexo blog settings
引用本站帖子
- 按文件名引用;第二个空为空则显示默认标题。
{% post_link '20250327xinjiang-1' '' %}
- 按文件名引用;第二个空为定制标题。
{% post_link '20250327xinjiang-1' '测试链接' %}
效果:测试链接
置顶文章
修改front-matter,添加sticky,值为数字。数字大,则文章越靠前。
sticky: 10
插入设定图片
{% img [class names] /path/to/image [width] [height] '"title ext" "alt text"' %}
{% asset_img sontag1.jpg 800 600 title %}
{% asset_path sontag1.jpg 800 600 title %}
设置帖子部分显示
插入<!--more-->
在此之前的内容显示,之后的内容不显示。
注意
<!--more-->
之前如果为空,则默认显示全部。
单行标注
`标注的内容`
效果:标注的内容
多行标注
<!-- 不显示-->
效果:不显示–>
代码块无法显示空行
修改hightlight.js,增加第11行的内容。
文件地址:“\node_modules\hexo-util\lib\highlight.js”
var lines = data.value.split('\n');
var numbers = '';
var content = '';
var result = '';
var line;
for (var i = 0, len = lines.length; i < len; i++) {
line = lines[i];
if (tab) line = replaceTabs(line, tab);
numbers += '<div class="line">' + (firstLine + i) + '</div>';
line = (line.length != 0) ? line : ' '; // 如果是空行的话,在div的内容添加个 
content += '<div class="line';
content += (mark.indexOf(firstLine + i) !== -1) ? ' marked' : '';
content += '">' + line + '</div>';
{% endcodeblock %}}
参考:Hexo代码无法显示空行,并且行数和代码不对齐 | 楼兰故居
居中引用
{% cq %} 引用文字 {% endcq %}
效果:
引用文字
字体相关
同html
<center> 文本居中 </center>
<font face="黑体">字体</font>
<font face="黑体" size=3>字体大小</font>
<font color=red size=4>字体颜色</font>
效果:
blockquote
单行引用, 用'>'; 多行引用,用多个'>'。
> content
> content
tag-plugin用法 https://hexo.io/zh-cn/docs/tag-plugins
test
tag-plugin用法 https://hexo.io/zh-cn/docs/tag-plugins
使用blockquote
{% blockquote tag-plugin用法 https://hexo.io/zh-cn/docs/tag-plugins %}
content
{% endblockquote %}
blockquote参数:
blockquote [author[, source]] [link] [source_link_title]
content
codeblock
//代码块
codeblock [title] [lang:language] [url] [link text] [additional options]
简单点用
```javascript
code content
```
Hexo-Next主题设置
文内引用
# 标题1
test
引用标题1:[标题1](#标题1)
# 标题 2
test2
引用标题2:[标题2](#标题-2)
# <a id="biaoti">标题 3</a>
引用标题3:[标题3](#biaoti)