Preface
由于过去的Hexo博客被自己不断魔改,功能日趋复杂,所以根据自己的改动写下了这篇博客来告诉自己如何维护(笑。大家有兴趣完Hexo的话也可以参考一下我的魔改方法。Hexo站:https://hexo.gyrojeff.moe
融合的功能:
- 主题魔改
- 自动同步cnblogs
- 自动GitHub备份源文件
- 启用Submodule进行管理
- config在private repo中备份
下面是正文:
Personal Blog - hexo.gyrojeff.moe
Personal blog of Haoyun Qin. Powered by Hexo
& Next
Maintaining
Project Tree
代码语言:javascript复制===================================================================
hexo.gyrojeff.moe (Private)
├── hexo-theme-next (Submodule, Private)
│ Description: Modified theme of NeXT.
│ Directory: ./themes/next/
├── hexo-cnblogs-sync (Submodule, Public)
│ | Description: Scripts for syncing service to cnblogs.
│ │ Directory: ./scripts_cnblogs/
│ ├── config (Folder)
│ │ ├── blog_config.json (File, Ignored)
│ │ │ Description: Configuration file of cnblogs account.
│ │ └── header.html (File): Cnblogs template.
│ ├── data (Folder, Ignored)
│ │ └── blog_data.json (File, Ignored)
│ │ Description: Information of synced articles. (e.g. id)
│ └── cnblogs.py: Sync script.
├── hexo-cnblogs-generated (Submodule, Private)
| Description: Files for cnblogs, used for syncing directly.
| Directory: ./public_cnblogs/
├── public (Folder, Ignored)
| Description: Temporary Deploy Folder for htmls.
└── config_cnblogs (Folder, Should not be modified manually)
Description: Contains config files, important for migration
===================================================================
Deploying Commands
Step 1: Generate & Check
代码语言:javascript复制hexo clean # Clean the previously generated file (Not compulsory)
hexo generate
hexo server # Start local server to check the work
Step 2: Deploy — Deploy to the website repository.
代码语言:javascript复制hexo deploy
Step 3: Sync to cnblogs
cd scripts_cnblogs # Important, the script only work in this directory
python cnblogs.py # Note: some dependencies are needed
Step 4: Version Control (If needed)
The following directories should be concerned:
./
— Main Project./themes/next/
— Theme Project./scripts_cnblogs/
— Script Project./public_cnblogs/
— Cnblogs output repository
Project Migrating
Step 1: Clone the main project. (Along with the submodule)
Step 2: Migrate (Copy) the needed configuration files.
./scripts_cnblogs/data/
./scripts_cnblogs/config/blog_config.json
If syncing everything is properly synced, you can find the files in config_cnblogs
just in the root directory.
本文作者:博主: gyrojeff 文章标题:Hexo博客的管理方法
本文地址:https://cloud.tencent.com/developer/article/1827310
版权说明:若无注明,本文皆为“gyro永不抽风!”原创,转载请保留文章出处。
许可协议:署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 转载请保留原文链接及作者!
我的博客即将同步至腾讯云 社区,邀请大家一同入驻