Hugo Vendor Theme vs Submodule
When you use a theme as a submodule, it pulls files from git and keeps the theme updated. However, if there is a problem you also inherit that problem. You can effectily clone a theme and modify it separately too. In my case I was using a submodule, and needed it to be a local theme instead. Here are the steps I used (on windows).
The Entire Reason
When trying to run hugo, I received an error. It occurred after a hugo update, and the theme had issues that requires a manual fix. Because it was a submodule, my fixes would not “stick”. Here is the error:
Error: html/template:blog/list.html:7:12: no such template "_internal/pagination.html"
Now to the permanent fix:
Remove the submodule (keeping the actual files):
# Remove submodule references but keep the files
git rm --cached themes/hugo-theme-techdoc
git rm -f .gitmodules
# Remove git's internal submodule tracking
rmdir /s /q .git\modules\themes
Make .git directory a regular folder instead
# This converts it from a submodule to regular files
rmdir /s /q themes\hugo-theme-techdoc\.git
Make manual changes needed (ie: pagination)
# Edit the problematic file
notepad themes\hugo-theme-techdoc\layouts\blog\list.html
changed
{{ template "_internal/pagination.html" . }}
to
{{ partial "pagination.html" . }}
Add/Commit it all
# Add all theme files as regular files
git add -A
git commit -m "Vendor theme instead of submodule with pagination fix"
git push
Other Fixes/Info I tried
Saving these steps for future reference
Tried Finding Pagination Error
D:\sites\site.tabs.jamesfraze>findstr /s /n /i /p /r "_internal[\\/]*pagination\.html" *.*
D:\sites\site.tabs.jamesfraze>findstr /s /n /i /p /r "_internal" *.*
Tried reviewing theme version
D:\sites\site.tabs.jamesfraze>git submodule status
595a9485fa85822873e6c9ac738edfd6ba30413d themes/hugo-theme-techdoc (v1.0.2)
D:\sites\site.tabs.jamesfraze>type .gitmodules
[submodule "themes/hugo-theme-techdoc"]
path = themes/hugo-theme-techdoc
url = https://github.com/thingsym/hugo-theme-techdoc.git
D:\sites\site.tabs.jamesfraze>cd themes\hugo-theme-techdoc
D:\sites\site.tabs.jamesfraze\themes\hugo-theme-techdoc>git log -1 --oneline
595a948 (grafted, HEAD, tag: v1.0.2) Merge branch 'release-1.0.2'
D:\sites\site.tabs.jamesfraze\themes\hugo-theme-techdoc>git ls-files --stage themes/hugo-theme-techdoc
D:\sites\site.tabs.jamesfraze\themes\hugo-theme-techdoc>cd ..
D:\sites\site.tabs.jamesfraze\themes>cd ..
D:\sites\site.tabs.jamesfraze>git ls-files --stage themes/hugo-theme-techdoc
160000 595a9485fa85822873e6c9ac738edfd6ba30413d 0 themes/hugo-theme-techdoc
D:\sites\site.tabs.jamesfraze>cd themes\hugo-theme-techdoc
D:\sites\site.tabs.jamesfraze\themes\hugo-theme-techdoc>git fetch --tags
D:\sites\site.tabs.jamesfraze\themes\hugo-theme-techdoc>git tag
v0.1.0
v0.2.0
v0.2.1
v0.2.2
v0.3.0
v0.4.0
v0.5.0
v0.6.0
v0.7.0
v0.8.0
v0.8.1
v0.8.2
v0.8.3
v0.9.0
v0.9.1
v0.9.2
v0.9.3
v0.9.4
v0.9.5
v0.9.6
v0.9.7
v0.9.8
v0.9.9
v1.0.0
v1.0.1
v1.0.2
Finally I just gave up and removed the submodule as per the first part of the instructions.