MetaObject Blog Post Reference?

jaymewelch
Shopify Partner
1 0 4

When creating a MetaObject field, Blog Posts are not one of the types you can reference. Am I missing something or is this intentionally not included?

I know I can use the Link type but I prefer to allow the user to select his blog post to avoid broken links in the future. Thanks!

Replies 5 (5)
growth-croiss
Shopify Partner
6 0 1

Yes, same issue there... difficult to understand why !

---
Benjamin from GROWTH Croissance
www.growth-croissance.com
scottn
Shopify Partner
6 0 2

Oooof!

I'm trying to map out our CMS migration to Shopify and this missing piece has me pretty stuck. I did not notice blog references were not a thing... This seems really important. Please add this. We were intending to add "Related Articles" on products, blog articles, and pages. I was also hoping to implement blog article categorization using metaobjects, but none of this is very doable without the blog reference. Someone please tell me I'm just missing something, or the feature is rolling out tomorrow or something.

JorgeGS
Shopify Partner
1 0 1

I'm having the same problem. Please Shopify, add this feature! It's really important.

growth-croiss
Shopify Partner
6 0 1

Waiting for a solution, I'm using that with a metafield of article ID # :

 

{%- for id in product.metafields.custom.blog_posts.value limit: section.settings.posts_count -%}
  {% for article in blogs.journal.articles %}
      {% if article.id == id %}
        {%- render 'blog-post-card', article: article, blog: section.settings.blog, show_category: section.settings.show_category, show_accroche: section.settings.show_accroche, show_excerpt: section.settings.show_excerpt, show_read_more: section.settings.show_read_more, sizes: sizes -%}
      {% endif %}
  {% endfor %}
{% endfor %}
---
Benjamin from GROWTH Croissance
www.growth-croissance.com
scottn
Shopify Partner
6 0 2

Hey @growth-croiss , I like your solution. I think if you stored article handles instead of ids you could probably avoid that inner for loop and use the articles liquid object like so:

 

{% assign article = articles['potion-notions/new-potions-for-spring'] %}

 

 

 Otherwise you might be able to use the where filter to get at your article by id:

 

{% assign article = articles | where 'id', id | first %}