Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Slash issue in themesDir and similar settings #3568
archetypedir: "src/archetypes" contentdir: "src/content" dataDir: "src/data" layoutdir: "src/layouts" staticdir: "src/static" themesdir: "src/themes"
The culprit seems to be the src directory; if I move the folders one dir up, to the same dir as
It's like Hugo can't figure out the config file on Windows. Because I still don't get the config path after
OS: Windows 7 64-bit.
Having the exact same issue here! I'm using the same version of hugo with the identical configuration (yet as JSON), but on Windows 10 64 bit.
However, I've found a fix: Changing the forward slashes to backward flashes seems to fix the issue. So, for example, changing
Still - is this intended? Seems to me it's a Windows-only issue related of not normalizing paths correctly?
No, it is a bug and we will fix it. But remember that Hugo is all about paths and URLs and we support Windows + a bunch of Unix variants, so this is an easy mistake to make.
But a change to
changed the title from
panic: runtime error: slice bounds out of range
Slash issue in themesDir and similar settings
Jun 8, 2017
Believe me, without
referenced this issue
Jun 18, 2017
Bit then it will fail on non Windows won't it?…
On Jul 8, 2017 10:48, "Bjørn Erik Pedersen" ***@***.***> wrote: @XhmikosR <https://github.com/xhmikosr> no, this has always behaved like this, and this works fine if you use "\" slashes. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3568 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAVVtWGfDA1HhzqcT_Zyc0IXgia6ahEDks5sLzQwgaJpZM4NzICW> .
This error can be recreated on Linux (OpenSuSE 42.1) and MacOS Sierra (10.12.5) with hugo 0.25.1.
Three conditions must be met:
So if you fire up a new hugo directory, download a theme, config and run hugo, you won't have a problem. But as soon as you put something (even an empty file) in the layouts directory, it fails:
Interestingly, if you use a trailing slash on the layouts directory, you see a fencepost error in the path:
Also interesting, if you don't specify a layouts directory, everything works fine:
That a --layoutDir argument triggers it makes sense given that the stack trace points at line 448 of hugo/tpl/tplimpl/template.go which is pretty explicitly operating on the path of the layout directory:
template.go lines 446 - 448: