Metaobjects not appearing in search results for Search and Discovery

Metaobjects not appearing in search results for Search and Discovery

treezcode
Tourist
4 0 1

I have used metaobjects to dynamically create pages, but the pages do not display in the search results of the Search and Discovery app. Is there a solution for this? I have multiple pages created with metaobjects as it seemed to be a cleaner solution than creating a mass amount of separate pages. Better content management at the cost of having the pages not appear in the search results is a difficult pill to swallow. Any suggestions?

Replies 3 (3)

lynth
Shopify Partner
199 11 33

You can use template files to create pages, but I don't think you can use metaobjects with the Search and Discovery app. It looks like you can only use simple metafields there. If I'm wrong, please let me know guys. You can use metafields with the Search and Discovery app as filters, for example, colors, prices, sizes, etc.

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!
treezcode
Tourist
4 0 1

I'm confused as to how I should resolve this issue. Yes, I could just create a page for each item and use a template to dynamically render a different metaobject onto each page, but this seems extremely tedious and not friendly for UX. Currently I have the metaobject pages creating breadcrumbs based on there handle. The URL structure for each item is: "https://floridafungi.farm/pages/our-fungi/chestnut-mushroom", if I don't use the metaobject pages I lose the hierarchy of the handle. The user navigates from "Our Fungi" >> "[specific fungi]", so it seems natural for the URL to reflect this. Also the breadcrumbs I have created will break without this handle. Am I overseeing something simple? I tend to over engineer solutions and I feel this may perhaps be one of those moment. 

I appreciate you taking time to help me understand.

lynth
Shopify Partner
199 11 33

Shopify has a flat structure, so it has some limitations regarding the creation of nested categories. Unlike some other e-commerce platforms, Shopify does not natively support multi-level categories. This means categories cannot be nested in the traditional sense. Instead, Shopify uses collections, which can be presented in a way that simulates nesting, but they are not technically nested.

This can be worked around by creating parent and sub-collections and manually linking them on the site. For example, you can have a "Clothing" collection with links to sub-collections like "T-Shirts," "Pants," etc., in the navigation menu. Anyway, it's not a real subcategory.

Shopify also doesn't natively support breadcrumbs, but you can add them by editing the Liquid template files.

To add breadcrumbs you can:

  1. Open the template file, such as theme.liquid.
  2. Add code in the appropriate place (usually in the header or footer) to generate breadcrumbs based on the current URL path.
  3. Use Liquid variables like page_title, collection.title, product.title to dynamically create breadcrumbs.

The final code will depend on your store's structure and theme, but here is a sample Liquid code:

 

<!-- Breadcrumbs -->
<nav class="breadcrumb">
  <a href="/">Home</a>
  {% if template == 'collection' %}
    <span> / </span>
    <span>{{ collection.title }}</span>
  {% elsif template == 'product' %}
    <span> / </span>
    <a href="/collections/{{ collection.handle }}">{{ collection.title }}</a>
    <span> / </span>
    <span>{{ product.title }}</span>
  {% elsif template == 'page' %}
    <span> / </span>
    <span>{{ page.title }}</span>
  {% elsif template == 'blog' %}
    <span> / </span>
    <span>{{ blog.title }}</span>
  {% elsif template == 'article' %}
    <span> / </span>
    <a href="/blogs/{{ blog.handle }}">{{ blog.title }}</a>
    <span> / </span>
    <span>{{ article.title }}</span>
  {% endif %}
</nav>

 

 

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!