Hugo

Syna theme image fallthrough fails on Windows but works on Linux

UPDATED
What happens:
When I set an image in front matter of a content file I get this error:

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.

You can reproduce this issue by

git clone https://github.com/solrayc/synastarterhugoerror.git
cd \synastarterhugoerror\
git submodule update --init --recursive
hugo server

At this point the site renders with no errors.
To reproduce this error on Windows navigate to content/blog/chocolate/index.md and uncomment asset:

# [asset]
  image = "image.png"

See this exact github issue #629
Another similar github issue #630

Windows environment that fails:

  • Syna Theme version: v0.15.2
Hugo Static Site Generator v0.60.0/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.13.4"

Debian WSL on Windows 10 environment that works:

  • Syna Theme version: v0.15.2
Hugo Static Site Generator v0.60.0-F2DEA9B0/extended linux/amd64 BuildDate: 2019-11-27T10:17:14Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.13.4"

*Thank you @zwbetz for helping me figure out how to update hugo on linux *

Is this an issue with Hugo or with Syna theme?
How do I fix this error?

I use the latest version of hugo on WSL. Here’s how:

  • download a linux tarball of the version you want
  • un-tar it
  • move it to /usr/local/bin

This should help your test comparison.

1 Like

Thanks @zwbetz. Learned something new.

After testing this issue with the latest version of Syna theme with hugo v0.60 it’s apparent that this error only appears on Windows.

I have updated some important details on this issue in my initial post above.

1 Like