Hexo 博客
一,Front-matter
Front-matter 是 markdown 文件最上方以 — 分隔的区域,用于指定个别档案的变数。
- Page Front-matter 用于配置页面
- Post Front-matter 用于配置文章页
Page Front-matter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| --- title: # 【必需】页面标题 date: # 【必需】页面创建日期 updated: # 【必需】标签、分类和友情链接三个页面需要配置 type: # 【可选】页面更新日期 comments: # 【可选】页面描述 description: # 【可选】页面关键词 keywords: # 【可选】显示页面评论模块(默认 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的配置) ---
|
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
| --- title: # 【必需】文章标题 date: # 【必需】文章创建日期 updated: # 【可选】文章更新日期 tags: # 【可选】文章标签 categories: # 【可选】文章分类 keywords: # 【可选】文章关键词 description: # 【可选】文章描述 top_img: # 【可选】文章顶部图片 comments: # 【可选】文章缩略图(如果没有设置top_img,文章页顶部将显示缩略图,可设为false/图片地址/留空) cover: # 【可选】显示文章评论模块(默认 true) toc: # 【可选】显示文章TOC(默认为设置中toc的enable配置) toc_number: # 【可选】显示toc_number(默认为设置中toc的number配置) toc_style_simple: # 【可选】显示 toc 简洁模式 copyright: # 【可选】显示文章版权模块(默认为设置中post_copyright的enable配置) copyright_author: # 【可选】文章版权模块的文章作者 copyright_author_href: # 【可选】文章版权模块的链接文章作者 copyright_url: # 【可选】文章版权模块的链接文章连结 copyright_info: # 【可选】文章版权模块的文字版权声明 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: # 置顶 ---
|
二,常用指令
1 2 3 4 5
| hexo clean hexo g hexo d hexo s hexo new 文章名
|
三,优化
文章链接优化
文章链接中文搞得乱码很不美观。
![image-20230328072501303](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
solution:
-
博客根目录,git bash。指令下载插件hexo-abbrlink
1
| npm install hexo-abbrlink --save
|
-
改根目录_config.yml
文件。修改permalink为:
1
| permalink: posts/:abbrlink.html
|
-
同时这个文件添加下面这些代码:
1 2 3 4
| #abbrlink配置 abbrlink: alg: crc32 # 算法:crc16(default) and crc32 rep: dec # 进制:dec(default) and hex
|
-
保存退出,然后push上去。
![image-20230328073437039](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)