gethexon / hexon

Let's hexo online.
https://hexon-demo.yujianghao.cn/#/
GNU General Public License v3.0
106 stars 22 forks source link

[feat]: 建议支持设置不同级别的 git 仓库 #21

Open yafey opened 1 year ago

yafey commented 1 year ago
hexo ------------------- git repo 1, hexo 级别设置。
+--hexon
+--source
     +--_posts  --------- git repo 2, submodule,post 的博文。
+--themes
     +-- next ----------- git repo 3, submodule,nexT 主题级别自定义设置。

目前如果配置 ssh 的话, 会把 hexon 也提交成一个 submodule 。 个人的想法是:如果可以做到 配置到 _posts 级别, 只更新博文相关, hexo 和 nexT 及 hexon 基本为固定或较少改动。

zS1m commented 1 year ago
hexo ------------------- git repo 1, hexo 级别设置。
+--hexon
+--source
     +--_posts  --------- git repo 2, submodule,post 的博文。
+--themes
     +-- next ----------- git repo 3, submodule,nexT 主题级别自定义设置。

目前如果配置 ssh 的话, 会把 hexon 也提交成一个 submodule 。 个人的想法是:如果可以做到 配置到 _posts 级别, 只更新博文相关, hexo 和 nexT 及 hexon 基本为固定或较少改动。

Hexon提供了自定义脚本的功能(pnpm script),我没理解错的话里面应该是可以执行任意git命令,那么就可以设置提交代码时提交哪些内容,比如只想提交博客目录下的_post文件夹可以使用下方命令:

git add ./_post

理解有误的话请指正

YuJianghao commented 1 year ago

可以使用自定义脚本功能,pnpm script 配置 git 相关的脚本

添加需要运行的脚本:git_sync.sh, git_save.sh

hexo
+--hexon
+--git_sync.sh
+--git_save.sh
+--source
     +--_posts

git save 脚本设置成 bash ./git_save.sh

# git_save.sh
git add ./source/_posts
git commit -m "chore: server update posts"
git push

对于更复杂的配置可以根据实际情况修改

zS1m commented 1 year ago

可以使用自定义脚本功能,pnpm script 配置 git 相关的脚本

添加需要运行的脚本:git_sync.sh, git_save.sh

hexo
+--hexon
+--git_sync.sh
+--git_save.sh
+--source
     +--_posts

git save 脚本设置成 bash ./git_save.sh

# git_save.sh
git add ./source/_posts
git commit -m "chore: server update posts"
git push

对于更复杂的配置可以根据实际情况修改

或许页面左上角的“操作”可以提供一个“增加自定义命令的功能”,允许用户增加多条快捷操作,这样楼主的需求也能够被很好地满足 image