Error: What to replace .File.Dir with in hugo-book

@bep If it’s not too much extra work, can the warnings also contain the template file name and line number? I believe you had some framework in place to make that possible.

1 Like

If you tell me how to do that, I will consider it.

Here’s a quick example that I found:

Can we print that filename info for the zero object .File warnings too?

A quick update: may be that linked example is not the best one in this context because that example is printing the location to a content file, while here we want to get the location to a template file.

But you did have something in place that fetched the template file name and line number that allowed showing the error causing line in live reload. I was hinting towards that approach to help get the file name and line number for the warnings too.

@kaushalmodi if you don’t have a simple way of doing what you’re suggesting, I suggest we stick to the topic.

I can add that I get a little bit grumpy when people try to stick more work on to remotely related issues, as if that somehow would make it more effective. I don’t know any simple way of adding filename/line numbers to the relevant WARNINGs. If I had, it would already be there.

You already know that I am not a Go coder.

You could have simply stated that what I suggested wasn’t possible. There wasn’t a need for such a snide remark.

My suggestion was so that folks don’t have to grep their source to figure out what’s causing that warning, but ¯\_(ツ)_/¯

@bep So does this mean the issue is effectively resolved pending the arrival of 0.55.2?

I use v0.74.3 and

{{ $myjs := path.Join .File.Dir "my.js" }}

in baseof.html throws the same warning.

The if or with solution doesn’t work neither.