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'm getting to know the project, it looks interesting. I checked one of the examples from the documentation and it didn't work as I expected. the word "Index" was not included in the title. Something is wrong or I don't understand the idea.
@areqq interesting. Probably something changed in years due to code refactors. I'm gonna check this in the following days, the blocks code might be broken in certain scenarios, or the documentation just need updates; I'm sorry for the bother.
In the meantime, you can use variables instead (this is what I usually do for things like page titles):
layout.html:
{{ common_title = globals().get("common_title", "My Webpage") }}
{{ page_title = globals().get("page_title") }}
{{ title = f"{page_title} - {common_title}" if page_title else common_title }}
<!DOCTYPE html><htmllang="en"><head>
{{ block head }}
<linkrel="stylesheet" href="style.css" /><title>{{ =title }}</title>
{{ end }}
</head><body><divid="content">
{{ block main }}
{{ include }}
{{ end }}
</div><divid="footer">
{{ block footer }}
Copyright 2020 by you.
{{ end }}
</div></body></html>
index.html:
{{ page_title = "Index" }}
{{ extend "layout.html" }}
{{ block head }}
{{ super }}
<styletype="text/css">
.title { color:#336699; }
</style>
{{ end }}
<h1>Index</h1><pclass="title">
Welcome to my awesome homepage.
</p>
I'm getting to know the project, it looks interesting. I checked one of the examples from the documentation and it didn't work as I expected. the word "Index" was not included in the title. Something is wrong or I don't understand the idea.
https://github.com/emmett-framework/renoir/blob/master/docs/quickstart.md
Template inheritance
output:
The text was updated successfully, but these errors were encountered: