-
Notifications
You must be signed in to change notification settings - Fork 55
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃 Html layouts and views, having difficulties and I need help #168
Comments
Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Hi, please move this report in our template repository |
please use the embed tag in every layout and do not define anything yourself template/html/views/layouts/main.html Line 9 in 4b29ea1
our logic will then make sure that your template is rendered into the layout, Lines 206 to 211 in 4b29ea1
like in the example in the readme |
@ReneWerner87 I have found those docs helpful but with For example how do I pass the title of the page, previously in the layout it was:
and in a view that uses the template:
|
Template system works independently from this embed tag The render function must be passed variables which can then be used in layout or in the template which is rendered into the layout. |
Thanks, i looked through the html.go and noticed that. Code for anyone should they come across this: return c.Render("companies", fiber.Map{
"MetaTitle": "All Companies",
"MetaDescription": "Some description",
}, "layouts/base")
|
Much appreciated for the quick help! I was lost without you. |
Question description
Can I please have an example of how views and layouts are supposed to interact with each other in Fiber?
At the moment i have set up layouts and views but if I use the layout in more than one view it seems to bug out.
I have initialised views like so
In my html folder is both my views and layouts
I made a base layout and in it i define base (as per some example from the internet):
I use the base template in a view by defining it
^ this works, but if I used the template again in another view then it shows this view as if something is cross pollinating.
The fiber docs on this matter were no help.
The text was updated successfully, but these errors were encountered: