I have an include file with a wad of narly html that turns into feedback form, lets call it feedback.html
I need to sometimes include this, and sometimes not. For sake of this conversation, lets just assume that the condition boils down to if foo == 'bar'
Which way is faster/better? I’m trying to optimize for build time, as my writers use serve
mode a lot, and precious seconds wasted on each rebuild loop add up across the day.
Always include the file in the layout, and put the condition inside of the include:
layout.html
{% include feedback.html %}
feedback_html
{% if foo == 'bar' %}
HTML...
{% endif %}
Or put the condition in the layout, and have the include just straight flat file
layout.html
{% if foo == 'bar' %}
{% include feedback.html %}
{% endif %}
feedback.html
HMTL…