Hello there, @Lednerb here.
I’ve developed the Bilberry Hugo Theme and yesterday a user wanted to change the directory name from bilberry-hugo-theme
to bilberry
, but this caused an error on his side.
The problem is that I’ve wanted to code via the DRY principle and hacked on the partials includes:
{{ if or (fileExists (print "layouts/partials/content-type/" .Type ".html") ) (fileExists (print "themes/bilberry-hugo-theme/layouts/partials/content-type/" .Type ".html")) }}
Therefore I hardcoded the theme’s directory name.
Now I want to improve this so that the users can change the directory name.
I thought I can simply do something like this:
{{ if or (fileExists (print "layouts/partials/content-type/" .Type ".html") ) (fileExists (print "themes/" .Site.Theme "/layouts/partials/content-type/" .Type ".html")) }}
(Using a .Site.Theme
variable or something similar because the theme
var matches the themes directory name…)
But this variable is not available, and I’ve found nothing in the docs.
Do you have any idea to archive this?
A second issue will occur if the user changes the default themes/
folder.
I’m tracking this via: https://github.com/Lednerb/bilberry-hugo-theme/issues/26
Best regards and thanks for your help.