alex-shpak / hugo-book

Hugo documentation theme as simple as plain book
https://hugo-book-demo.netlify.app
MIT License
3.21k stars 1.16k forks source link

Strange issues on build... #627

Open wehrend opened 1 month ago

wehrend commented 1 month ago

I've having some issues with hugo related to the book theme currently. Working on my laptop, so I cannot verify what the issue here... So cant lookup what I could simply check on my workstation...

Error: Error building site: "/src/content/themes/hugo-book/layouts/_default/_markup/render-image.html:1:1": unmarshal failed: invalid character '{' looking for beginning of object key string Built in 2398 ms

the mentioned file looks like the following:

{{- if .Page.Site.Params.BookPortableLinks -}} {{- template "portable-image" . -}} {{- else -}} <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> {{- end -}}

{{- define "portable-image" -}} {{- $isRemote := or (in .Destination "://") (strings.HasPrefix .Destination "//") }} {{- if not $isRemote }} {{- $path := print .Page.File.Dir .Destination }} {{- if strings.HasPrefix .Destination "/" }} {{- $path = print "/static" .Destination }} {{- end }} {{- if not (fileExists $path) }} {{- warnf "Image '%s' not found in '%s'" .Destination .Page.File }} {{- end }} {{- end }} <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> {{- end -}}