Hi, This is a question about Selmer templates.
My Selmer templates have include selmer tag to include header.html. When I request is a htmx request and has hx-request header in it, I don't want the include to happen? I tried a if tag, but it did not work. Has anyone tried it?
include is a bit special because it gets resolved during template compile time, so you can't do conditional includes when rendering
you could move the if into your include though and then have it render its content conditionally
I do it the other way around, with the conditional in my Clojure code rather than in the template. In my request handler, if thereβs the hx-request header I only render a template with the actual content. Without that header, I render a template with the headings, footer, etc which also then includes the previously mentioned template with the content.
Moving the condition to the include file sounds fine to me..
thank you
Hi @yogthos, tagging you for obvious reasons π