Yes, can you use content_for? and yield in haml for template inheritance. Example:
Base.html.haml
% html
= render "layouts / head"
% body
.container.container-main
= content_for? (: page_content)? yield (: page_content): yield
Now you can use 'page_content' from another haml =>
Derived.html.haml
- content_for: page_content do
/ contents
Everything contained in the content_for: block_name block is executed in the context of the corresponding result in the layout.
source share