template icon indicating copy to clipboard operation
template copied to clipboard

Template layout handlebars title not replacing properly.

Open pateljoel opened this issue 2 years ago • 3 comments

I'm using fiber for a small project and just started with the handlebars example.

I am trying to make the template work with the <title>{{title}}</title> tag and it doesn't update instead the source shows <title></title> which is what I don't understand.

Help would be appreciated.

pateljoel/gofiber-templating-title-issue

pateljoel avatar Jan 21 '22 14:01 pateljoel

@pateljoel can you try a variable name starting with capital letters in the map and in the template, maybe this is a golang problem, because you can only access variables that start with capital letters

ReneWerner87 avatar Jan 21 '22 15:01 ReneWerner87

@ReneWerner87 I have tried using captial letters myself and the title still didn't show up with the title "Homepage" this is the source output:

<html>
  <title></title>
  <body>
    <div>
      <div>index</div>
     </div>
  </body>
</html>

You can clone the test repo here pateljoel/gofiber-templating-title-issue and try reproducing the issue on your side.

pateljoel avatar Jan 21 '22 19:01 pateljoel

Hi folks, I am having the same issue. I also tried the capital letters option as well, also without success. Not only title not being replaced, any var passed to the layout. Any recommendation on how to make this work?

Alternatively, I will stop using layouts as passing vars in the rest of the templates works fine.

edimoldovan avatar May 06 '22 14:05 edimoldovan