0%

迁移博客

换了电脑后,准备重新整理一下博客,索性直接把一起的仓库重命名作为backup,再新建一个github.io的仓库。记录了一些注意事项以及配置。

搭建

Windows11

  • git:生成ssh密钥
  • Nodejs:安装hexo以及各种命令执行要在git bash中完成。

Blog根目录下的_config.yml中,设置deploy的参数(main分支)

1
2
3
4
deploy:
type: git
repo:
github: https://github.com/Seanxz401/Seanxz401.github.io.git,main

Next主题

1
git clone https://github.com/theme-next/hexo-theme-next themes/next

Blog根目录下的_config.yml中设置theme: next

语言设置

  1. 到themes/next/languages下查看支持哪些
  2. Blog根目录下的_config.yml,设置language

标签和分类设置

1
2
hexo new page "tags"
hexo new page "categories"

修改生成的md文件中的type

设置总是显示侧边栏

设置头像

OSS图床

https://blog.csdn.net/m0_56723295/article/details/124985789

https://picgo.github.io/PicGo-Doc/zh/guide/config.html#github%E5%9B%BE%E5%BA%8A

hexo命令

1
2
hexo help [cmd]
hexo new -p [categories_path/]title #生成md文件到指定目录下

修改Front-matter

即新建博客时时自动生成的文章头部内容,在博客根目录下的”\scaffolds\post.md”中。新增categories和description

hexo插件

直接在博文目录下建立 scripts 文件夹,建立一个 js 脚本文件,把代码写进去就行了。 hexo 启动的时候,会自动载入 scripts 目录下的所有脚本。https://frapples.github.io/articles/2016-09-21-6d0.html

https://hexo.io/zh-cn/api/console

想实现根据路径自动生成categories字段的,看了API文档,头晕,选择从源头解决。直接修改hexo库的代码