{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
<div class="grid grid--no-gutters collection-grid">
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign featured = link.object.handle -%}
{%- include 'collection-grid-item', collection: collections[featured] -%}
{%- endif -%}
{%- endfor -%}
</div>
</div>
วางโค้ดลงในไฟล์ page.list-collections
Brooklyn
รหัสสำหรับ Brooklyn
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
{%- assign collection_count = 0 -%}
{%- assign isEmpty = true -%}
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign collection_count = collection_count | plus: 1 -%}
{%- endif -%}
{%- endfor -%}
<div class="grid collection-grid">
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign collection = collections[link.object.handle] -%}
{%- assign collection_index = collection_index | plus: 1 -%}
{%- assign collection_handle = collection.handle -%}
{% include 'collection-grid-collage' %}
{%- endif -%}
{%- endfor -%}
</div>
วางโค้ดลงในไฟล์ page.list-collections
Debut
โค้ดสำหรับธีม Debut
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign collection = collections[link.object.handle] -%}
<li class="grid__item {{ grid_item_width }}">
{% include 'collection-grid-item', collection_image_size: image_size %}
</li>
{%- endif -%}
{%- endfor -%}
</ul>
</div>
วางโค้ดลงในไฟล์ page.list-collections
Minimal
รหัสสำหรับ Minimal
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign featured = link.object.handle -%}
<div class="grid__item {{collection_item_width}} text-center">
{% include 'collection-grid-item' with collection_width: collection_width %}
</div>
{%- endif -%}
{%- endfor -%}
</div>
วางโค้ดลงในไฟล์ page.list-collections
Narrative
โค้ดสำหรับธีม Narrative
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{%- assign collection = collections[link.object.handle] -%}
{% include 'collection-card', collection: collection, width: desktopColumns, grid_style: grid_style %}
{%- endif -%}
{%- endfor -%}
</div>
</div>
</div>
</div>
วางโค้ดลงในไฟล์ page.list-collections
Simple
รหัสสำหรับ Simple
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
<div class="grid grid--uniform">
{%- for link in linklists[page.handle].links -%}
{%- if link.type == 'collection_link' -%}
{% assign collection = collections[link.object.handle] %}
<div class="grid__item {{ grid_item_width }}">
{% include 'collection-grid-item' %}
</div>
{%- endif -%}
{%- endfor -%}
</div>
วางโค้ดลงในไฟล์ page.list-collections
Venture
โค้ดสำหรับธีม Venture
คัดลอกโค้ด
{% comment %}
Featuring collections on a page using a menu
https://shopify-dev.com/tutorials/feature-a-subset-of-collections-on-a-page
{% endcomment %}
ตั้งชื่อเมนูให้เหมือนกับชื่อที่คุณตั้งให้กับหน้าซึ่งจะใช้แนะนำคอลเลกชันของคุณ ตัวอย่างเช่น หากหน้าที่คุณสร้างมีชื่อว่า Living Room ให้ตั้งชื่อเมนูของคุณว่า Living Room