這篇介紹Hexo Push GitHub To Update Categories And Tags Directory。
發生情境
1 2 3 4 5 6 7 8
| 在Hexo會有Categories和Tags分類 有可能在編輯文章時,因大小寫關係而有兩種以上但相同分類的情況發生。 ex: HTTP or Http
https://{url}/categories/HTTP/ https://{url}/categories/Http/
上面會有一個連結會出現404錯誤,而Google search console搜尋index就會出錯。
|
測試情境
1 2 3 4 5 6
| 將Categories和Tags修正只剩一個正確名稱後 $ hexo clean $ hexo g $ hexo d
發現deploy後,GitHub上面的Categories和Tags Directory並不會更動。
|
解決方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| 找到本機 {blog}/.deploy_git 開啟 Git Bash here
$ git rm -r --cached categories //刪除remote categories Directory $ git commit -m "delete categories" //commit加上註解 $ git rm -r --cached tags //刪除remote tags Directory $ git commit -m "delete tags" //commit加上註解 $ git push
這樣GitHub上的categories和tags Directory就會消失
$ hexo clean $ hexo g $ hexo d
就會將新產生的Directory commit進GitHub repo.
|