2
votes

I have an ecommerce site, and I'm trying to create a "Lookbook" template. I want my client to be able to create a new lookbook (just as a simple page with a template of "page.lookbook" or similar), then be able to go into the page admin and select and upload images, links, descriptions etc.

So far I have:

  • page.lookbook.liquid -> calls in the section, lookbook-template.liquid
  • lookbook-template.liquid has an HTML template

It also has this schema:

   {% schema %}
     {
       "name": "Lookbook",
    "blocks": [
      {
        "type": "Image",
        "name": "Lookbook image",
        "settings":[
          {
            "type": "image_picker",
            "id": "img",
            "label": "Image"
          },
          {
            "type": "text",
            "id": "description",
            "label": "Description",
            "default": "<p>You can write <em>html</em> <a href=\"https://example.com/\">in here</a>!</p>"
          }
        ]
      }
    ]
  }
{% endschema %}

This way, my client can use the simple admin tools to add a new image block. Very nice!

However, this method means that every single lookbook gets the SAME image data as whatever I apply to the lookbook-template.liquid, and this isn't ideal at all.

What am I doing wrong here, and what's the right solution? I want one template that the client choose to attach to a page, and then for each template to have a unique set of images, links and descriptions that the client creates.

1

1 Answers

0
votes

Unfortunately, section won't work to get some different content for each page with lookbook.page template.

A solution would be to install (or create) an app to manage metafields attached to pages. Then you can use metafields in your template.

Metafields is a way to add some extra fields in database: https://help.shopify.com/themes/liquid/objects/metafield