緣由
使用Hugo可以創建類似博客的網站,用md編輯文章后,hugo可以用網頁展示出來。 另外需要添加第三方themes, 而第三方themes是也是一個項目
所以需要在本項目里添加子模塊, 添加submodule很簡單,但是需要原來的module名字叫hugo-themes, 而hugo在生成網頁的時候,只認themes目錄
創建hugo項目
hugo new site demo
執行后會在demo目錄創建如下結構,為了添加自己的themes, 先將themes目錄刪除
ls
archetypes config.toml content docker_compose static themes
添加git后,再添加hugo-themes
子模塊
git submodule add https://gitlab.xxxx.com/xxxx/hugo-themes.git
然后目錄就多了hugo-themes
目錄,作為submodule 存在
更名並同步
git mv hugo-themes themes
git submodule sync
git add -u
git commit
git push
即可完成submodule 更名