Issue with partials\helpers\image.html. [asset] image="image.png" breaks the site.
See original GitHub issueIs this a BUG REPORT or FEATURE REQUEST?: bug
What happened:
I have content/_index/services.md
list fragment with front matter parameter section = blog
.
In content/blog/chocolate/
I have content fragment index.md
and an image image.png
.
Hugo throws an error when I set an image in fragment index.md
, like so:
[asset]
image = "image.png"
Here are the errors I get
Building sites … WARN 2019/11/05 19:05:16 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
ERROR 2019/11/05 19:05:16 render of "home" failed: execute of template failed: template: _default\list.html:9:7: executing "_default\\list.html" at <partial "helpers/fragments-renderer.html" (dict "page_scratch" .Scratch)>: error calling partial: execute of template failed: template: partials/helpers/fragments-renderer.html:18:8: executing "partials/helpers/fragments-renderer.html" at <partial (print "fragments/" .Params.fragment ".html") $context>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\fragments\list.html:31:8": execute of template failed: template: partials/fragments/list.html:137:30: executing "partials/fragments/list.html" at <partial "helpers/image.html" (dict "root" $root "asset" .Params.asset)>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\helpers\image.html:31:8": execute of template failed: template: partials/helpers/image.html:31:8: executing "partials/helpers/image.html" at <fileExists (printf "content/%s" $location)>: error calling fileExists: CreateFile D:\Websites\mywebsite\content\%!s(<nil>)\image.png: The filename, directory name, or volume label syntax is incorrect.
ERROR 2019/11/05 19:05:16 render of "taxonomyTerm" failed: execute of template failed: template: _default\list.html:9:7: executing "_default\\list.html" at <partial "helpers/fragments-renderer.html" (dict "page_scratch" .Scratch)>: error calling partial: execute of
template failed: template: partials/helpers/fragments-renderer.html:18:8: executing "partials/helpers/fragments-renderer.html" at <partial (print "fragments/" .Params.fragment ".html") $context>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\fragments\list.html:31:8": execute of template failed: template: partials/fragments/list.html:137:30: executing "partials/fragments/list.html" at <partial "helpers/image.html" (dict "root" $root "asset" .Params.asset)>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\helpers\image.html:31:8": execute of template failed: template: partials/helpers/image.html:31:8: executing "partials/helpers/image.html" at <fileExists (printf "content/%s" $location)>: error calling fileExists: CreateFile D:\Websites\mywebsite\content\%!s(<nil>)\image.png: The filename, directory name, or volume label syntax is incorrect.
ERROR 2019/11/05 19:05:16 render of "page" failed: execute of template failed: template: _default\single.html:9:7: executing "_default\\single.html" at <partial "helpers/fragments-renderer.html" (dict "page_scratch" .Scratch)>: error calling partial: execute of template failed: template: partials/helpers/fragments-renderer.html:18:8: executing "partials/helpers/fragments-renderer.html" at <partial (print "fragments/" .Params.fragment ".html") $context>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\fragments\list.html:31:8": execute of template failed: template: partials/fragments/list.html:137:30: executing "partials/fragments/list.html" at <partial "helpers/image.html" (dict "root" $root "asset" .Params.asset)>: error calling partial:
"D:\Websites\mywebsite\themes\syna\layouts\partials\helpers\image.html:31:8": execute of template failed: template: partials/helpers/image.html:31:8: executing "partials/helpers/image.html" at <fileExists (printf "content/%s" $location)>: error calling fileExists: CreateFile D:\Websites\mywebsite\content\%!s(<nil>)\image.png: The filename, directory name, or volume label syntax is incorrect.
ERROR 2019/11/05 19:05:16 render of "taxonomyTerm" failed: execute of template failed: template: _default\list.html:9:7: executing "_default\\list.html" at <partial "helpers/fragments-renderer.html" (dict "page_scratch" .Scratch)>: error calling partial: execute of
template failed: template: partials/helpers/fragments-renderer.html:18:8: executing "partials/helpers/fragments-renderer.html" at <partial (print "fragments/" .Params.fragment ".html") $context>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\fragments\list.html:31:8": execute of template failed: template: partials/fragments/list.html:137:30: executing "partials/fragments/list.html" at <partial "helpers/image.html" (dict "root" $root "asset" .Params.asset)>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\helpers\image.html:31:8": execute of template failed: template: partials/helpers/image.html:31:8: executing "partials/helpers/image.html" at <fileExists (printf "content/%s" $location)>: error calling fileExists: CreateFile D:\Websites\mywebsite\content\%!s(<nil>)\image.png: The filename, directory name, or volume label syntax is incorrect.
Total in 586 ms
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default\single.html:5:6: executing "_default\\single.html" at <partial "head.html" .>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\head.html:31:8": execute of template failed: template: partials/head.html:35:46: executing "partials/head.html" at <partial "helpers/image.html" (dict "root" $root "asset" .Params.asset "absolute" true)>: error calling partial: "D:\Websites\mywebsite\themes\syna\layouts\partials\helpers\image.html:31:8": execute of template failed: template: partials/helpers/image.html:31:8: executing "partials/helpers/image.html" at <fileExists (printf "content/%s" $location)>: error calling fileExists: CreateFile D:\Websites\mywebsite\content\%!s(<nil>)\image.png: The filename, directory name, or volume label syntax is incorrect.
What you expected to happen: I expected to see a thumbnail image for the blog post in the list fragment on my homepage. How to reproduce it (as minimally and precisely as possible):
You can reproduce this issue with my repo by uncommenting
[asset]
image = "image.png"
in content/blog/chocolate/index.md
Anything else we need to know?:
I tried Hogo versions 0.58.3 and 0.59.1. Both throw the same error.
I fully rely on themes build in partials. I do not have any custom partials.
Environment:
- Syna Theme version: v0.15.2
- Hugo version:
Hugo Static Site Generator v0.59.1/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.13.1"
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (7 by maintainers)
I recommend using WSL and building on Linux or using WSL for production as well. Supporting Windows is kinda hard and time consuming since none of us have a Windows development environment. We will investigate the issue given the chance. We are always happy to receive Pull Requests to improve our Windows support. I’m sorry for the inconvenience.
To add a last comment for now. We mainly support linux based systems. We’ll leave this open to track and figure out what’s the culprit over the long term. Assuming it might be due to our fragment logic, that adds “/” separators that are linux only.