Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange issues on build... #627

Open
wehrend opened this issue Jun 13, 2024 · 0 comments
Open

Strange issues on build... #627

wehrend opened this issue Jun 13, 2024 · 0 comments

Comments

@wehrend
Copy link

wehrend commented Jun 13, 2024

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 -}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant