Hello everyone
May someone please help me understand the difference between these two lines
Line 1
Line 2
Hello everyone
May someone please help me understand the difference between these two lines
Line 1
Line 2
@ThomasMaghanga The first is creating a class in the class attribute with this logic “template-{{ template | replace: ‘.’, ‘-’ | handle }}”
which is similar to another piece of logic creating the first class : “template-{{ template | replace: ‘.’, ’ ’ | truncatewords: 1, ‘’ | handle }}”
When comparing code/html lines like this it helps immensely to format code with line breaks between attributes for reading sanity
When having trouble interpreting an html tags class logic extract it out to it’s own code block being careful to not inadvertently remove whitespace between the classes
{%- capture body_classes - %}
template-{{ template | replace: '.', ' ' | truncatewords: 1, '' | handle }}
template-{{ template | replace: '.', '-' | handle }}
{% if request.path == '/challenge' %} template-challange {% endif %}
{%- endcapture - %}
FYI: “template-challange” is a typo it should be “template-challenge”
Thank you so much Paul, understood!