ZgotmplZ

When I use the {{< figure >}} shortcode and run a local server, it creates a werid ID instead of the URL I original entered. It’s a # followed by random characters. the link seems to lead to the page I’m on. The image link is broken (because it’s not an image, it’s a link to a webpage). Is this behavior something that will change with the live site? Or is this something I need to resolve?

attaching another picture showing how it looks like:

2021-10-15_18-13

From https://pkg.go.dev/html/template

“ZgotmplZ” is a special value that indicates that unsafe content reached a
CSS or URL context at runtime. The output of the example will be
<img src="#ZgotmplZ">

I suspect you need to use safeURL in your template or shortcode.

If this doesn’t resolve your problem, please post a link to the public repository for your project. See:
https://discourse.gohugo.io/t/requesting-help/9132

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

I see, though I don’t understand why this happens.

My understanding is that http: and https: are allowed, this supposed to happen if javascript is detected. I just tried a picture from wikipedia, https://commons.wikimedia.org/wiki/Commons:Featured_pictures#/media/File:Vexilla_vexillum_01.jpg and it got flagged as unsafe as well.

I use netlify to publish my site from gitlab, and get https through let’s encrypt. Will the https resolve this issue…? it doesn’t seem like it.

My site can be found at https://gitlab.com/taonaw/taonaw - though, this example is not there since I don’t want the broken link on my live site.

404 Page Not Found

Then find a way to share your broken code. Create a branch or zip the site and post it somewhere.

No. The “ZgotmplZ” value can appear under a variety of circumstances.

Sorry @jmooring ! my repo is private, I forgot I did that (back then I had more privacy concerns).

OK, I will create another repo, it’s good to have one to experiment on up and running anyway for cases such as these.

1 Like

OK, so I changed the project to be public. Should be the same link: https://gitlab.com/taonaw/taonaw .

I created a test post with this issue specifically, it’s at Test Post · The Art of Not Asking Why and it’s the latest update, so you should see it at the top.

The src argument to the figure shortcode must be an image URL. For example:

{{< figure src="https://example.org/a.jpg" >}}

Instead, you are passing markdown:

{{< figure src="![](https://example.org/a.jpg)" >}}

Don’t do that.

You can audit the build output for this and other silent errors/problems:

HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|hahahugo|\[i18n\]" docs/

Your site has several other issues…

I see. I think this is because of ox-hugo, which is an Emacs package I use to publish to hugo from org-mode. It creates the markdown from .org files, so I need to see what’s going on there I guess - unless there is something else there.

The site probably has a lot of issues which I don’t see/understand, at least not yet. It’s been a process…

I’ll see if I can find out more info.

I was trying to insert an image from frontmatter into my template but kept getting the same error. I solved it thus:

{{ if isset .Params "image" }}
    {{ $myVar := print .Params.image }}
    <img src="{{ $myVar }}">
{{ end }}

Notice that I first save the .Params.image as a variable, and then insert it as my src.