Can't add Rich Text Labels in SliceMachine

We recently upgraded our prismic repo to the Slice Machine repo. We are still using the Prismic UI to add new slices and make updates. I edit and add labels directly in the JSON editor.
Ex:
image

After I try to add a new slice, I get JSON errors related to labels. It somehow is parsing the "labels" incorrectly when previously it was just an array.
Ex:

Can we continue to use the Prismic UI to make updates and add slices rather than the Slice Machine CLI? Is this error relating to using the Prismic UI?

Hello @joyce, Could you please give me more details about your case?

You're missing the name of the slice, as well as the display option. If this "labels" key is in the correct place (that would be under body.config of your custom type) then adding those missing elements should work.

Take a look at the Full JSON Example in this article:

Hi @Pau, the slice name is ā€˜Contentā€™ and the display option is ā€˜listā€™. The ā€œlabelsā€ is specified under the config of the slice.

This is a rich text field and Iā€™m adding labels per this page:

Can you paste here the JSON of the Custom type? it'll be easier to debug that way. There must be a problem with the syntax.

    "content" : {
        "type" : "Slice",
        "fieldset" : "Content",
        "description" : "The rich-text workhouse used in article bodies.",
        "icon" : "text_fields",
        "display" : "list",
        "non-repeat" : {
          "content" : {
            "type" : "StructuredText",
            "config" : {
              "multi" : "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
              "allowTargetBlank" : true,
              "label" : "content",
              "labels" : [ "caption" ]
            }
          }
        },
        "repeat" : { }
      }

This above is the JSON for the slice (before any errors that come from clicking ā€œAdd a sliceā€. Only after I click ā€œAdd a sliceā€ does the below JSON automatically appear.

      "content": {
        "type": "Slice",
        "fieldset": "Content",
        "description": "The rich-text workhouse used in article bodies.",
        "icon": "text_fields",
        "display": "list",
        "non-repeat": {
          "content": {
            "type": "StructuredText",
            "config": {
              "multi": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
              "allowTargetBlank": true,
              "label": "content",
              "labels": {
                "": [
                  {
                    "name": "caption"
                  }
                ]
              }
            }
          }
        },
        "repeat": {}
      }

Do you see how it updates the labels? Is this error related to the move to the slice machine repo and utilizing the prismic UI instead of the slice machine CLI?

Hi @joyce ,

I can confirm that you can still use the UI to update and change your Custom types and slices. I was able to replicate your error on my side also.

I think the issue here is not because your updating the Custom type in the UI or any fault of your own. I think it's probably an error on Slice Machine repositories.

Anyway I've created an issue with the Dev Team and as soon as we have a reply I'll get back to you.

Thanks.

1 Like

Thank you so much Phil!

Hi @Phil,
Any updates on this? I'm still facing the same issue when using a custom label.

Hi Phillip,

There have been no changes in regards to this behaviour. In fact, on the new versions of Slice Machine, you shouldn't have access to edit the Slice Machine created Slice in the Prismic Dashboard.

So adding Rich Text Labels isn't currently possible with Slice Machine, but it is being tracked as a feature request and will most likely be implemented in the first quarter of next year.

When this is released the team will update you here.

Thanks.

1 Like

Thanks for the reply :blush:

Hi Phil,

We recently launched a new website using slice machine. Our content team is eager for the return of Rich Text labels, is the team still planning on releasing an update this quarter?

Thanks
Ben

Hello @ben.jackson, we still don't have any news regarding this feature request. We'll update this thread if anything changes.

Hi Everyone,

In the time being, my colleague Pryianka posted a workaround for this in a nother thread that I'll share here.