'shopify custom liquid section show blank when added via theme editor into an existing page

I created a "custom liquid" section with following code

<ul>
{% for product_type in collection.all_types %}
<li class="{{ product_type | handleize }}">
{{ product_type | link_to_type }}
</li>
{% endfor %}
</ul>

It suppose to show a list of product type name as link. But I see nothing. However, when I simply add text into the "Custom Liquid" section, I see it in the page when I add the liquid custom section in the theme's visual editor.

I am using the Free OS2.0 theme Any idea why?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source