How to do an if/else in HAML without repeating indented code
问题 Depending on if a user is signed in or not, I'd like to print a different kind of %body-tag. This is how I currently do it: - if defined? @user %body(data-account="#{@user.account}") %h1 Welcome -# all my content - else %body %h1 Welcome -# all my content As you can see there's a lot of duplicated code in there. How can I eliminate this? I already tried the following: - if defined? @user %body(data-account="#{@user.account}") - else %body %h1 Welcome -# all my content Unfortunately, this