简体   繁体   中英

Shopify liquid access to article object from handle

I would like to display the title of blog posts but the only thing that renders me is ulr addresses. This is how I display links from metafields:

{% for field in product.metafields.custom.related_product_with_blog_post.value %}
  <div><a href="{{ field.url }}">{{ field.url }}</a></div>
{% endfor %}

How to get to article object and display all article titles from metafields?

You already have your article object inside of the field variable. To fetch the blog post/ article's handle, just use field.handle .

See all available properties for the article object in the Shopify API docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM