What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: MetaObject Blog Post Reference?

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 8 (8)

growth-croiss
Shopify Partner
7 0 1

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

---
Benjamin from GROWTH Croissance
www.growth-croissance.com

scottn
Shopify Partner
10 0 7

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
7 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
10 0 7

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 %}

 

 

shiba-komino
Shopify Partner
2 0 0

my solution is create a new MetaObject Definition as "Blog Post reference",
then add "Blog Post Reference" as Blog post's metafield.

after that, we can create a new "blog post reference" in blog post's metafield.
and use this type of "Blog Post Reference" as field in another MetaObject.

manusam
New Member
6 0 0

Would you mind sharing the work around? This sounds like a possible solution, at least until Shopify realizes they've missed the articles metafield. Thanks!

sadDev
Visitor
1 0 0

I don't know if this will be helpful, but here's my work around: 

1) create a meta object called: "blog post reference"
2) Add 3 fields - blog post id, blog post title, blog post url 
3) Go through your blogs and make a few entries in the "blog post reference" metaobject definition

4) Go to setting -> custom data-> blog posts and create a metafield on that object type with the following specs: 
a) field type of meta object
b) select "list" for multiple selections
c) select the "blog post reference" metaobject definition we created above. 

*note- you can name the field anything you like - i'm just going to refer to it as "related reading"
Once you've completed those selections- save the field and pin the definition. 

Then- navigate back to your blog posts and open one. If you scroll to the metafields on the blog posts and select the "related reading" field. You will notice that the field has references to all of the references you created in the first step where we established the metaobject "blog post reference " and added many or all of our blog post entries. You can now search for titles and add references to multiple blog posts without having to copy and paste urls for each one. 

It would be ideal if we could automate the creation and destruction of these entries, but the options out there are very limited 😞