You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the Echo framework in Golang to serve HTML templates, but I have an issue where the title updates correctly. However, the content remains the same for both the home (/) and about (/about) pages.
When I navigate to /about, the title changes to "About | Application", but the content is still the same as the home page (/) instead of showing the correct about page content.
{{ template "layout" (dict "title" "Home") }}
{{ define "content" }}
<h1>Welcome to the Home Page</h1>
<p>This is a simple multi-page app with Echo.</p>
{{ end }}
templates/pages/about.html
{{ template "layout" (dict "title" "About") }}
{{ define "content" }}
<h1>About</h1>
<p>This is a simple multi-page app with Echo.</p>
{{ end }}
Expected Behavior / should render index.html inside layout/main.html. /about should render about.html inside layout/main.html.
Actual Behavior / works as expected. /about only updates the title but keeps the content from / (Home Page).
Possible Issue I suspect that {{ template "layout" (dict "title" "About") }} in about.html is calling layout directly and rendering "index.html" content instead of its own.
The text was updated successfully, but these errors were encountered:
Hi,
I am using the Echo framework in Golang to serve HTML templates, but I have an issue where the title updates correctly. However, the content remains the same for both the home (/) and about (/about) pages.
When I navigate to /about, the title changes to "About | Application", but the content is still the same as the home page (/) instead of showing the correct about page content.
Project Structure
Code Implementation main.go (Entry Point)
views/renderer.go (Template Renderer)
handlers/home.go
handlers/about.go
Templates
templates/layouts/main.html (Layout)
templates/pages/index.html
templates/pages/about.html
Expected Behavior / should render index.html inside layout/main.html. /about should render about.html inside layout/main.html.
Actual Behavior / works as expected. /about only updates the title but keeps the content from / (Home Page).
Possible Issue I suspect that {{ template "layout" (dict "title" "About") }} in about.html is calling layout directly and rendering "index.html" content instead of its own.
The text was updated successfully, but these errors were encountered: