Hexohexo框架无成本博客
Anyzir
博客文章
安装环境
Cloudflare:https://dash.cloudflare.com/
安装hexo并初始化
安装hexo
初始化文件夹
启动hexo
图床
https://img.131213.xyz/
推送到远端
- 安装依赖:
npm install hexo-deployer-git --save
- 推送:
hexo cl; hexo g; hexo d
安装主题安知鱼
在博客根目录里安装最新版主题
git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu
第一次使用需要安装 pug 以及 stylus 的渲染器
npm install hexo-renderer-pug hexo-renderer-stylus --save
应用主题
修改 hexo 配置文件_config.yml,把主题改为anzhiyu
theme: anzhiyu
覆盖配置
将/themes/anzhiyu/_config.yml复制到根目录下并重命名为_config.anzhiyu.yml
生成分类页和标签页
1
| hexo new page categories; hexo new page tags
|
找到 source/categories/index.md 这个文件,修改添加 type: “categories”
1 2 3 4 5 6 7
| --- title: 分类 date: 2024-07-05 03:36:48 aside: false top_img: false type: "categories" ---
|
找到 source/tags/index.md 这个文件,修改添加 type: “tags”
1 2 3 4 5 6 7
| --- title: 标签 date: 2024-07-05 03:36:02 type: "tags" comments: false top_img: false ---
|
配置文章模版
/scaffolds下post.md是文章模板,page.md是标签页模板
post.md模版
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 39 40 41 42 43 44 45 46 47 48 49
| --- title: {{ title }} date: {{ date }} updated: tags: categories: keywords: description: top: top_img: comments: cover: https://img.090227.xyz/file/ae62475a131f3734a201c.png toc: toc_number: toc_style_simple: copyright: copyright_author: copyright_author_href: copyright_url: copyright_info: mathjax: katex: aplayer: highlight_shrink: aside: swiper_index: 10 top_group_index: 10 ai: background: "#fff" --- <div class="video-container"> [up主专用,视频内嵌代码贴在这] </div>
<style> .video-container { position: relative; width: 100%; padding-top: 56.25%; /* 16:9 aspect ratio (height/width = 9/16 * 100%) */ }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>
|
page.md模版
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| --- title: {{ title }} date: {{ date }} type: updated: comments: description: keywords: top_img: https://img.090227.xyz/file/ae62475a131f3734a201c.png mathjax: katex: aside: aplayer: highlight_shrink: top_single_background: ---
|
插件
文章置顶
安装
npm install hexo-generator-topindex --save
设置
1 2 3 4 5 6 7 8 9
| --- title: 每天一个linux命令 date: 2017-01-23 11:41:48 top: 1 categories: - 运维 tags: - linux命令 ---
|
开启本地搜索
安装
1
| npm install hexo-generator-search --save
|
设置
1 2 3 4
| local_search: enable: true preload: false CDN:
|