optimize my liquid code, make it more logic and shorter {% liquid assign hasdesktopimage…
- User
optimize my liquid code, make it more logic and shorter
{% liquid assign has_desktop_image = false assign has_mobile_image = false assign desktop_class = false
if section.settings.image_desktop_1 != blank assign has_desktop_image = true endif if section.settings.image_mobile_1 != blank assign has_mobile_image = true assign desktop_class = 'hidden md:block' endif%}
{% if has_desktop_image %} {% include 'component-image' with image: section.settings.image_desktop_1, width: 1600, class_custom: desktop_class, aspect_ratio: false %} {% if has_mobile_image %} {% include 'component-image' with image: section.settings.image_mobile_1, width: 1200, class_custom: 'block md:hidden', aspect_ratio: false %} {% endif %} {% endif %}
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.