Automating selected collections in Collection list with collection.metafields or collection.template

Hi,

We are migrating to a Shopify 2.0 theme and I am not able to replicate the method that was used to assign collections to a collection-list page template. It was using the collection.template_suffix to assign products


      {%- unless linklist.empty? -%}
        {%- for link in linklist.links -%}
          {%- if link.type != 'collection_link' -%}
            {%- continue -%}
          {%- endif -%}

          {%- include 'collection-item', collection: link.object, apply_overlay: section.settings.apply_overlay -%}
        {%- endfor -%}
      {%- else -%}
        {%- for collection in collections -%}
          {% if page.template_suffix == "collections.marques" %}
      		{% if collection.template_suffix == "marque" %}
              {%- unless collection.handle == 'frontpage' -%}
                {%- include 'collection-item', collection: collection, apply_overlay: section.settings.apply_overlay -%}
              {%- endunless -%}
     		{% endif %}
      	  {% else %}
            {%- unless collection.handle == 'frontpage' -%}
            	{%- include 'collection-item', collection: collection, apply_overlay: section.settings.apply_overlay -%}
            {%- endunless -%}
          {% endif %}
        {%- endfor -%}
      {%- endunless -%}
    

As new code is copletely different


            

              {%- assign collections_to_show = section.settings.collections | default: collections -%}

              {%- for collection in collections_to_show -%}
                {%- if collection.featured_image == blank or section.settings.collections == empty and collection.handle == 'frontpage' -%}
                  {%- continue -%}
                {%- endif -%}

                
                  

                    {%- capture sizes -%}(max-width: 699px) 100vw, (max-width: 1149px) {{ 100 | divided_by: section.settings.collections_per_row_desktop | at_least: 50 }}vw, {{ 100 | divided_by: section.settings.collections_per_row_desktop }}vw{%- endcapture -%}
                    {{- collection.featured_image | image_url: width: collection.featured_image.width | image_tag: loading: 'lazy', sizes: sizes, widths: '200,300,400,500,600,800,1000,1200,1400,1600,1800,2000,2200,2400', class: 'zoom-image group-hover:zoom', draggable: 'false' -}}

                    

                      

{{ collection.title }}

                    

                  

                
              {%- endfor -%}
            

How may I assign specific collections in the loop using either a collection.template_prefix or a custom collection metafield?

I tried, this and it did not work (metafield accessible to online store)

{%- for collection in collections_to_show -%} 
                {%- if collection.metafields.custom.collection_test == "oui" -%}

                {%- continue -%}
                {%- endif -%}

Thank you