【问题标题】:Shopify linking product using SEO handle codingShopify 使用 SEO 句柄编码链接产品
【发布时间】:2021-08-19 17:32:36
【问题描述】:

我按照说明将产品标记到博客的第二种方法

这是我使用的网站https://happypoints.io/shopify-add-products-to-blog-post-c2-stt-66/ 这是输入的代码 {% assign my_description = article.content | split: '=== 分割内容 ===' %}

 {% assign  my_description_size = my_description.size | minus: 2 %}
  {{ my_description | first}}
 <div class="show-product-list">           
   {% if article.tags.size > 0 %}             
       {% for tag in article.tags %}
       {% paginate collections.all.products by 100 %}
       {%- for product in collections.all.products -%}
           {% if product.handle == tag %}
              <div class="product_item">
               {% include 'product-card-list' %} 
             </div> 
           {% endif %}
       {%- endfor -%}
       {% endpaginate %} 
       {% endfor %}          
   {% endif %}
 </div>
   {{ my_description | last}}

按照所有指示后,我收到一条错误消息

液体错误(sections/article-template.liquid 第 42 行):找不到资产 sn-ps/product-card-list.liquid

我不确定为什么产品不会使用 seo 句柄链接到博客。我已正确复制并粘贴此代码,但仍然出现此错误

采集码:

{% if collection.title == blank %}
  {% assign collection_image = blank %}
{% elsif collection.image %}
  {% assign collection_image = collection.image %}
{% else %}
  {% assign collection_image = collection.products.first.featured_media.preview_image %}
{% endif %}

{% unless collection.title == blank %}
  {% include 'card-image', type: collection_image, grid_style: grid_style %}
{% else %}
  <div class="card__image-wrapper">
    {% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
    {{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
  </div>
{% endunless %}

<div class="card__info">
  <h3 class="card__name h4">{% if collection.title != blank %}{{ collection.title }}{% else %}{{ 'homepage.onboarding.collection_title' | t }}{% endif %}</h3>

  {% if section.settings.show_description and collection.description != blank %}
    <div class="rte card__description{% if width == '2' %} card__description--padding{% endif %}">
      {{ collection.description | strip_html | truncatewords: 15 }}
    </div>
  {% endif %}
</div>

【问题讨论】:

    标签: encoding shopify


    【解决方案1】:

    您已正确复制/粘贴代码。 问题是您的主题在 sn-ps 文件夹中没有名为“product-card-list”的文件。 这是包含集合页面上产品图块代码的文件,此文件的名称可能因您使用的主题而异。 您需要找出正确的文件名并用它替换“product-card-list”。 如果您分享您的 collection.liquid 文件中的代码,可以进一步帮助您。

    【讨论】:

    • 谢谢!我已经贴在上面了。
    • @Jo11 集合代码似乎不完整,因为它没有渲染产品的逻辑。渲染产品的代码如下所示: {% for product in collection.products %} 变量名称“product”可能会有所不同。
    猜你喜欢
    • 1970-01-01
    • 2016-09-26
    • 1970-01-01
    • 1970-01-01
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-14
    相关资源
    最近更新 更多